-1

This question already has an answer here:

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 ?

marked as duplicate by Celada, mdpc, Anthon, Michael Homer, Archemar Mar 20 '15 at 6:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    Really? My copy of the man page for passwd does document -l. – Celada Mar 20 '15 at 6:02
  • mine doesn't. And I can't find it online either. – Kaizer Sozay Mar 20 '15 at 6:03
  • First Google hit for "passwd man page" documents it. – Celada Mar 20 '15 at 6:03
  • But can you explain what the above does ? Does it just set the username as blank? – Kaizer Sozay Mar 20 '15 at 6:04
  • 1
    Uh... They're trying to "lock the password of the named account", exactly as documented. No?? It sounds like maybe what you want to know is how the -l option is implemented internally. But that's not what you asked. – Celada Mar 20 '15 at 6:10
3

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

2

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
1

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)

https://unix.stackexchange.com/a/55115/2594

Not the answer you're looking for? Browse other questions tagged or ask your own question.