gpt4 book ai didi

chef-infra - 创建用户的 Chef Recipe

转载 作者:行者123 更新时间:2023-12-05 00:42:16 25 4
gpt4 key购买 nike

我想创建一个新用户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'd 到盒子上。但是,我无法以 kevin 用户的身份使用 su,密码为 kevin

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

查看 Chef “用户”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.

如何修改我上面的 Recipe ,以便我可以使用相同的密码 sukevin

最佳答案

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

openssl passwd -1 "theplaintextpassword"

或者如果你使用 mkpasswd:

mkpasswd -m sha-512

关于chef-infra - 创建用户的 Chef Recipe ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22646419/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com