When is executed the sudo adduser <username> --disabled-login
command, is created an user being locked because is disabled login. It can be confirmed with the passwd -S <username>
command that shows something like:
<username> L ...
To unlock is necessary define a password first, therefore is possible accomplish this goal with either the passwd
or usermod
command as follows:
sudo passwd -u <username>
passwd: unlocking the password would result in a passwordless account.
You should set a password with usermod -p to unlock the password of this account.
sudo usermod -U <username>
usermod: unlocking the user's password would result in a passwordless account.
You should set a password with usermod -p to unlock this user's password.
Therefore is indicated twice to use the usermod -p
command. Now according with the man usermod
for the -p
option is indicated
-p, --password PASSWORD
The encrypted password, as returned by crypt(3).
Note: This option is not recommended because the password
(or encrypted password) will be visible by users listing
the processes.
The password will be written in the local /etc/passwd or
/etc/shadow file. This might differ from the password
database configured in your PAM configuration.
You should make sure the password respects the system's
password policy.
My concern is about the note indication. Is it in someway deprecated?. Therefore
Question
- What is the correct approach to unlock a disabled login user?
sudo passwd <user>
on its own is sufficient to enable login for<user>
sudo passwd <username>
- it is based according your own experience or is indicated explicitly in some place? I could assume the currentman usermod
would suggest use thepasswd
instead. I've seen this approach in otherman
commands