I have seen people use passwd -l "$USERNAME" ,
But the linux man page does not explain what the -l option is for. What does it do ?
I have seen people use passwd -l "$USERNAME" ,
But the linux man page does not explain what the -l option is for. What does it do ?
I got this by issuing the passwd command at the CLI
-l, --lock lock the password of the named account
It locks the account so that root has to unlock the account before this person can log-in and use the account again.
EDIT As it was indicated this is a duplicate of this
The -l switch for passwd locks the user account by changing the password to a value which matches no possible encrypted value. Only root has access to passwd -l.
Note that passwd -l does not keep the user from gaining access through other means such as authentication tokens (like SSH keys).
To lock access to a user account:
passwd -l username
To unlock an account again:
passwd -u username
It is documented:
$ man passwd
...
-l, --lock
Lock the password of the named account. This option disables a
password by changing it to a value which matches no possible
encrypted value (it adds a ´!´ at the beginning of the password).
...
shadow-utils 4.1.5.1 07/26/2013 PASSWD(1)