user locked in Linux

How To Check User Account Locked or Not In Linux

if you’re not aware of how to check user account locked in Linux. So there’re many ways to find out. You can locked user either by passwd or usermod command.

You can also use the chage -l username command to check the status of user locked or not in Linux. if it’s locked you will see /sbin/nologin at the end of shadow file.

Check Out : Force User to Change Password At first Login

Step 1 : Lock the user password

passwd -l username

you can check user password locked or not in /etc/shadow file. If you find “!!” sign with this user that means password locked.

Step 2 : To unlock the password

passwd -u username

Check the same file again. You must be seen there’s no “!!” means user password unlocked now. 

Check Out : How To Check Linux Version Using Command Line

Step 3 : you can also lock the user account.

usermod -l username

To unlock the account,

usermod -U username

you can also check the user information with below command.

lslogins username

Check Out : How To Change Owner And Group of Directory In Linux

you can also use this command to check the status of user password,

passwd -S username

YouTube Link :

You’re done

Sponsored

LEAVE A REPLY

Please enter your comment!
Please enter your name here

one + 11 =