I mentioned the passwd
command in the previous recipe. It is used to update a user’s authentication tokens. You will need to be the root user for this example. We will use the test1
user created in the above section.
Let’s work with the passwd
command a little:
From a user account, login to
test1
to make sure that still works as expected:su - test1
Enter the password when prompted. This should work without errors.
Now let’s lock this account. Exit back to root and run:
passwd -l test1
From a user account run
su - test1
and enter the password again. It should fail.Go back to root and unlock the account using the command
passwd -u test1
. Log in again to make sure it works.Now let’s expire the account. This will force the user to create a new password. As root run the following command:
passwd -e test1
Now as a guest user, log into
test1
using the commandsu - test1
. Enter your password.You will be told to create a new password. Be careful here as you have...