Sunday, October 2, 2016

Account lock unlock status in Linux

Requirement : To check current password status of account in Linux Solution : 1. To check if account is locked or not. Below are two ... thumbnail 1 summary
Requirement :

To check current password status of account in Linux

Solution :

1. To check if account is locked or not.
Below are two examples of command outputs when account is locked and when account is not locked.


# passwd -S user1
user1 LK 2016-10-01 0 90 7 -1 (Password locked.)

# passwd -S user1
user1 PS 2016-10-01 0 90 7 -1 (Password set, MD5 crypt.)



# cat /etc/shadow |grep -i user1
user1:$1$ZFXgKhSG$lroasdrS0QM4iji.4h1:17075:0:90:7:::   <--- Account is not locked

# cat /etc/shadow |grep -i user1
user1:!!$1$ZFXgKhSG$lroasdrS0QM4iji.4h1:17075:0:90:7:::  <---Account is locked


2. Lock account manually.



# passwd -l user1
Locking password for user user1.
passwd: Success


3. Unlock account manually.



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


No comments

Post a Comment

Any thoughts?