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



  • lock account, unlock account
  • 0 Utilizadores acharam útil
Esta resposta foi útil?

Artigos Relacionados

SSH login without password

You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic login...

How to remove a Linux user

How do I drop or remove old users account from my Linux server? I can login using the user’s SSH...

How to restrict and except SSH access to specific IPs

Once your IP is public it gets attention from so many bots in the internet that do brute force...

Adding a user to a group

Synopsis This article describes how to add a Linux user (account) to a group. Environment...

Create a user with no password

This article shows you how to create a user account without a password or an empty password on...

Powered by WHMCompleteSolution