To prevent the user account from logging into sytem with an immediate effect, Locking an user account is best option. In this following post, you will learn how to lock/unlock the user account in redhat linux.
Prerequisites:
1. Sudo access user account.
Things to Mind before delete a user or group in redhat linux :
- Ensure you are in the correct host machine using hostname command.
Here are the steps on how to lock/unlock the user account in redhat linux.
Step 1 : Execute the below command to check the present status of the user account.
sudo grep –i <username> /etc/shadow
From the above snap, can see the user account status is active as the second field starts with $6.
Step 2 : To lock the user account use the below command.
sudo passwd –l <username>
Or
sudo usermod –L <username>
Step 3 : Verify the user account using the command shown in step1.
sudo grep –i <username> /etc/shadow
Step 4 : For unlocking the user account, use the below command.
sudo passwd –u <username>
Step 5 : Verify the user account status as shown in step 1.
sudo grep –i <username> /etc/shadow
How do you feel about this post? Drop your comments below..