How to lock password for Linux user

There are chances some user may misuse the system or do some unacceptable activity and you found such activity on the server in this case it may required to lock the users to login to server. this can be done using passwd command .you can run this command  as root or sudo user.


command syntax:


passwd -l user name

below command will lock the user India so that user can not login to the server

example :

#passwd -l india


You can find the changes on /etc/shadow file, in the password filed you will see "!"

You can find the difference before and after locking the user as below screenshot.



You will get "Login Incorrect" error while login after locking the user.


To unlock you can use below command

#passwd -u india




How to lock password for Linux user How to lock password for Linux user Reviewed by TecGeeks News on June 08, 2016 Rating: 5

No comments:

Get Your Business Online Now


Powered by Blogger.