【问题标题】:Chef Cookbook for Creating User创建用户的厨师食谱
【发布时间】:2014-03-26 12:11:00
【问题描述】:

我想创建一个新用户kevin,密码为kevin

cookbooks/make_user/recipes/default.rb

user "kevin" do
  comment "default user"
  home "/home/kevin"
  shell "/bin/bash"
  password "kevin"
end

配置我的 Vagrant 盒子后,我 ssh 到盒子上。但是,我无法以kevin 用户的身份使用su,密码为kevin

[vagrant@vagrant-centos65 ~]$ su kevin
Password: 
su: incorrect password

查看 Chef 'users' docs,我不确定 password 是要修改的正确属性。

password    The password shadow hash. This attribute requires that 
            ruby-shadow be installed. This is part of the Debian package: 
            libshadow-ruby1.8.

如何修改我上面的食谱,以便sukevin 使用相同的密码?

【问题讨论】:

    标签: chef-infra


    【解决方案1】:

    如文档所示:http://docs.opscode.com/resource_user.html#password-shadow-hash,您需要使用 OpenSSL 生成影子哈希:

    openssl passwd -1 "theplaintextpassword"
    

    或者如果你使用mkpasswd:

    mkpasswd -m sha-512
    

    【讨论】:

      【解决方案2】:

      说明书用户资源的文档描述了“密码”属性是如何加密的。它还描述了如何使用 openssl 设置值:

      【讨论】:

        猜你喜欢
        • 2015-02-05
        • 1970-01-01
        • 1970-01-01
        • 2012-07-14
        • 2021-11-01
        • 1970-01-01
        • 2019-01-29
        • 1970-01-01
        • 2015-12-13
        相关资源
        最近更新 更多