How To Force Password Change in Ubuntu 16.04/CentOS 7

Improves the security and strength that users have to change their password to log in to Ubuntu and CentOS Linux.

For this tutorial, we will use Ubuntu 16 and CentOS 7.

How to verify the configuration of the user in Linux

Remember that each user created in a Linux system brings a specific configuration associated with your password such as expiration date password status, among other values.

As we do not always have this information at hand, we will use the chage command to validate the information of a particular user, the syntax to use is:

chage –l (User)

In this case, we will use chage -l Solvetic and the result obtained will be as follows:

How To Force Password Change in the Next Login

With these values in mind we will proceed to force the respective password change to the user the next time that you log in, for this we will carry out the following process:

To force the password change, we will enter the following syntax:

sudo chage -d0 (user)

In our example, it would be

sudo chage -d0 solvetic

Alternatively we can use the following command to end the current password and thus request the update at the next login:

sudo passwd -e (user)

The execution of these commands does not display any results since everything works internally. We can use the chage -l Solvetic command again to check the status of the account at the password level:

We see that it has been defined that the password must be modified since it expires.

Now when we start a session in Ubuntu 16 or CentOS 7 we will see the following message:

In this way, we have forced the user to update his password in the next login in one of the most used Linux distros. Let's take advantage of these options to increase the level of security in Linux systems.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *