How to lock and unlock user account in linux.With the help of two commands you can lock and unlock the user account in Linux.

To Lock the user account in Linux,use the given below command syntax

By Using Passwd command
#passwd -l username

OR

By using usermod command
#usermod -L username

To lock the user account called user1 in linux system

[root@localhost ~]# passwd -l user1
Locking password for user1.
passwd: Success

OR

[root@localhost ~]# usermod -L user1

To Unlock the user account in Linux, use the given below command syntax

By Using Passwd command
#passwd -u username

OR

By using usermod command
#usermod -U username

To unlock the linux user account called user1

[root@localhost ~]# passwd -u user1
Unlocking password for user1.
passwd: Success

OR

[root@localhost ~]# usermod -U user1
[root@localhost ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *