Check account lockout status linux

We can get status of account in two ways.

1. From /etc/shadow file
2. Using passwd command

Using passwd command:
If account is locked, we will see LK as shown below.

[root@localhost ~]# passwd -S k2admin1
k2admin1 LK 2017-01-08 0 99999 7 -1 (Password locked.)

If account is unlocked, we will see PS as shown below.

[root@localhost ~]# passwd -S k2administrator
k2admin PS 2017-01-08 0 99999 7 -1 (Password set, MD5 crypt.)
[root@localhost ~]# passwd -S k2administrator
k2administrator PS 2017-01-08 0 99999 7 -1 (Password set, MD5 crypt.)
[root@localhost ~]#

Check account lockout status linux using /etc/shadow file: Account status is stored in /etc/shadow file. If exclamation is there after ‘username:’ which means account is locked. Otherwise account is unlocked.

[root@localhost ~]# more /etc/shadow | grep k2admin1
k2admin1:!$1$Y9Glu8aM$4q7nK6/NnuGUgilMMhiUX1:17175:0:99999:7:::

In the below example, exclamation(!) is not there

[root@localhost ~]# more /etc/shadow | grep k2administrator
k2administrator:$1$jVkaxZ9B$Q62MGwOfq/Je2wHP66zIm0:17175:0:99999:7:::

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by k2schools
Skip to toolbar