加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

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

发布时间:2020-12-13 17:23:11 所属栏目:Linux 来源:网络整理
导读:我的SSH服务器设置只使用公钥认证,禁用密码认证. 通过puppet添加用户时,我想禁用用户密码. 到目前为止,我已经提出了这个,这似乎有效,但我不确定这有多安全: user { 'john': ensure = 'present',comment = 'John Smith',groups = ['adm','sudo','wheel','use
我的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).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读