Lock User
Method 1
[root@test ~]# passwd -l username
Method 2
[root@test ~]# usermod -L username
Unlock User
Method 1
[root@test ~]# passwd -u username
Method 2
[root@test ~]# usermod -U username
Check Status of Users
[root@test ~]# more /etc/shadow
username:!!$6$pmQO0ZPH$POolvCzxe1nsd1OpLkMc6E3cd1ffOkcz224caQs1d/oL.OwscUhYfcas//41sS12.:16531:0:99999:7:::
Note : If you see “!!” expression or “!” expression start of password of username, the user is locked.