lock a user in linux


To lock the password# passwd -l user1Locking password for user user1.passwd: Success 

# grep user1 /etc/shadow user1:!!$6$ciJaoDR9$Qpt9sctRLjbZ4/Agxy9UOvu/XQqNrFo9rpgfZ/xrF/8J...//you will see the two !! meaning the user is locked

To unlock the user

# passwd -u user1Unlocking password for user user1.passwd: Success

To check status

# passwd -S user1user1 LK 2014-08-17 0 99999 7 -1 (Password locked.)

If the user account is unlocked you will output like below# passwd -S user1user1 PS 2014-08-17 0 99999 7 -1 (Password set, SHA512 crypt.)

2016-07-04 12:26:34gstlouis