当我使用 Chef 在系统中创建用户时,我总是将其公钥上传到.ssh/authorized_keys. 当用户第一次登录时,他需要“更改”他的密码。为此,使用存根密码,因此他可以输入“当前”密码。这是现在的样子:
ssh user@host
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Connection to host closed.
Run Code Online (Sandbox Code Playgroud)
当前密码是众所周知的(我会告诉你一个秘密initial:),无论如何这是无用的。如何避免current第一次询问密码?(更强调一下,它是安全的,因为用户已经使用他的公钥进行了身份验证)。