如何让Chef找到Active Directory用户?

问题描述 投票:1回答:2

错误:

Chef::Exceptions::UserIDNotFound
--------------------------------
cannot determine user id for 'builduser', does the user exist on this system?

这是我的(修剪过的)厨师食谱:

if node['platform'] == 'centos'
  package 'yum-utils'
  execute 'yum-config-manager --enable cr'
end

include_recipe "python::source"

...

## Setup key for jenkins... https://supermarket.chef.io/cookbooks/ssh_authorized_keys
ssh_authorize_key '[email protected]' do
    key 'AAAAB3Nz...hiOQ=='
    user 'builduser'
    group 'builduser'
end

此用户不是由此配方创建的,但已存在于此CentOS VM所连接的Active Directory中。

任何人都知道如何告诉厨师从Active Directory中读取这个内容?

提前致谢

active-directory centos chef
2个回答
0
投票

您可能正在遇到可怕的“nsswitch.conf重新加载”问题。它第二次工作还是总是失败?如果它第二次运行,可能是因为/etc/nsswitch.conf仅在Chef运行的早期更新,并且由于libc缓存nsswitch数据库配置的方式,在Chef进程重新启动之前,这些更改将不可见。如果它总是失败,请检查机器是否具有正确的nsswitch配置以使AD用户可见。仅在PAM上链接到AD对于用户条目来说是不够的。


0
投票

我的解决方法/解决方案是创建root拥有的文件资源,然后将它们chown给用户。不知何故...... chown似乎没有AD的问题。

file '/home/orgz_test/builduser/.ssh/authorized_keys' do
  content 'ssh-rsa AAAAB3Nz...hiOQ== [email protected]'
  mode '0644'
end

# user and group setting in 'file' or 'directory' does not work... so, do it manually
bash "Change ownership" do
    user "root"
    group "root"
    code <<-EOC
        chown builduser /home/orgz_test/builduser/.ssh/authorized_keys
        chgrp builduser_g /home/orgz_test/builduser/.ssh/authorized_keys
        chmod 600 /home/hedgeservtest.com/cashmgmt/.ssh/authorized_keys
    EOC
end

不是最漂亮的解决方案......但是有效。

© www.soinside.com 2019 - 2024. All rights reserved.