How To Check User Account Locked or Not In Linux

0
465

If you’re not aware of how to check the user account locked in Linux. So there’re many ways to find out. You can lock the user either by passwd or usermod command. we can also unlock the Linux user accounts using the command line.

How To Check User Account Locked or Not In Linux:

You can also use the chage -l username command to check the status of the 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 log in

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.

check user locked

Step 2: To unlock the password

passwd -u username

linux unlock user account

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 the below command.

lslogins username

linux unlock user accounts

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

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

passwd -S username

YouTube Link:

You’re done linux unlock user account

LEAVE A REPLY

Please enter your comment!
Please enter your name here