Chef infra 如何在节点中获取chef客户端进程的用户

Chef infra 如何在节点中获取chef客户端进程的用户,chef-infra,Chef Infra,如何在节点中获取chef客户端进程的用户 the user who runs the chef-client agent. 我使用ps命令来获取用户,但效果不好。获取节点中chef客户端进程用户的任何特定ruby方法。在每次客户端运行时为用户填充一个 the user who runs the chef-client agent. 节点['current_user'] 最近很少有ohai插件被标记为可选插件。确保使用client.rb文件启用它们,以便节点['current_user']获取

如何在节点中获取chef客户端进程的用户

the user who runs the chef-client agent.
我使用ps命令来获取用户,但效果不好。获取节点中chef客户端进程用户的任何特定ruby方法。

在每次客户端运行时为用户填充一个

the user who runs the chef-client agent.
节点['current_user']

最近很少有ohai插件被标记为可选插件。确保使用client.rb文件启用它们,以便节点['current_user']获取当前用户

将以下内容添加到client.rb,然后使用节点['current_user']-

ohai.optional_plugins = [
  :Sessions,
  :Lspci,
  :Passwd
]

您不知道作为哪个用户启动chef客户端?除非你要求,否则它不会做任何奇怪的事。唯一的改变可能是使用sudo和刀子命令。请发展,因为我不明白你的问题。在几乎所有情况下,这将是根。你想做什么来获取这些信息?