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

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

[root@localhost ~]# more /etc/shadow | grep k2administrator

Lock Linux account

After creating a user account, some time later we have to lock the account. Account lock or unlock can be done with usermod command.

Examples:Create User account and change the password

Password complexity in Linux

  • root user can change password of a self and of any user in the system, there are no rules for root to assign a password. Root can assign any length of password either long or short, it can be alphabet or numeric or both. On the whole there is no limitation for root for assigning a password.

Change password in Linux

  • As a root user, we can change any password to user.
  • The syntax for assigning is $passwd (The one with which we have logged in, if it is root then root’s password will be changed)
  • #passwd to assign a password to a specific user, only root can assign password to other user.


Find command in Linux

Find command in Linux is used to find the files or directories path. It is exactly like the find option in window where we can search for a file.


find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path…] [expression]


Powered by k2schools
Skip to toolbar