linux – 如何通过puppet安全地禁用用户密码?

我的SSH服务器设置只使用公钥认证,禁用密码认证.

通过puppet添加用户时,我想禁用用户密码.

到目前为止,我已经提出了这个,这似乎有效,但我不确定这有多安全:

user { 'john':
    ensure     => 'present',comment    => 'John Smith',groups     => ['adm','sudo','wheel','users'],home       => '/home/john',managehome => true,shell      => '/bin/bash',password   => '*',}

正在使用密码=> ‘*’定义被认为可以安全地禁用用户密码?

解决方法

shadow(5)手册页说

If the password field contains some string that is not a valid result of crypt(3),for instance ! or *,the user will not be able to use a unix password to log in (but the user may log in the system by other means).

所以是的,使用*是安全的.的! passwd(1)使用加密密码的第一个字符来表示密码被锁定(passwd -l),这可以解锁(passwd -u).

dawei

【声明】:唐山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。