解锁已禁用的登录用户的正确方法是什么?

解锁已禁用的登录用户的正确方法是什么?

当执行该sudo adduser <username> --disabled-login命令时,会创建一个被锁定的用户,因为已禁用登录。可以使用以下passwd -S <username>命令进行确认,如下所示:

<username> L ...

要解锁,首先需要定义一个密码,因此可以使用passwdusermod命令来实现这一目标,如下所示:

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.

因此指示两次使用该usermod -p命令。现在根据man usermod指示的选项-p指示

-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.

我担心的是笔记指示。它在某种程度上被弃用了吗?因此

问题

  • 解锁的正确方法是什么已禁用登录用户?

相关内容