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 ?
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)
passwddoes document-l. – Celada Mar 20 '15 at 06:02-loption is implemented internally. But that's not what you asked. – Celada Mar 20 '15 at 06:10