chef 用户资源不会更新现有用户的主目录(如果它已经存在)
chef user resource does not update an existing user's home directory if it already exists
我试图确保我的厨师食谱创建一个新的 unix 用户或更改现有用户(如果它已经存在),使用以下资源
user 'postgres' do
supports :manage_home => true
home '/home/postgres'
shell '/bin/bash'
password #{password}
action :create
end
但在以下情况下:
已创建用户 postgres 但 /home/postgres 的所有者是 root
配方给出输出 user[postgres] action create (up to date)
即使指定了 :manage_home => true
。
create/update 用户及其主目录有更好的方法吗?
不幸的是,:manage_home => true
唯一要做的就是创建主目录(如果主目录不存在)。如果它存在它什么都不做,即使有错误的权限。
我在每个用户资源之后都有一个目录资源,以确保主文件夹正确无误:
directory '/home/postgres' do
owner 'postgres'
group 'postgres'
mode 0755
end
我试图确保我的厨师食谱创建一个新的 unix 用户或更改现有用户(如果它已经存在),使用以下资源
user 'postgres' do
supports :manage_home => true
home '/home/postgres'
shell '/bin/bash'
password #{password}
action :create
end
但在以下情况下:
已创建用户 postgres 但 /home/postgres 的所有者是 root
配方给出输出 user[postgres] action create (up to date)
即使指定了 :manage_home => true
。
create/update 用户及其主目录有更好的方法吗?
不幸的是,:manage_home => true
唯一要做的就是创建主目录(如果主目录不存在)。如果它存在它什么都不做,即使有错误的权限。
我在每个用户资源之后都有一个目录资源,以确保主文件夹正确无误:
directory '/home/postgres' do
owner 'postgres'
group 'postgres'
mode 0755
end