如何以“root”身份执行软件包安装通过厨师中的 sudo 吗?

发布于 2024-11-14 12:00:40 字数 234 浏览 4 评论 0原文

使用 Chef,是否可以在安装包的配方中添加一些内容,以使包命令作为超级用户运行,而不是作为超级用户运行 Chef 命令,例如,

package "mysql" do
  user: sudo
  action :install
end

因此这将执行 sudo apt-get install mysql 而不是比 apt-get install mysql 。在文档中找不到任何内容。

With chef, is it possible to add something to a recipe that is installing a package to make the package command run as the super user rather than run the chef command as the super user, e.g.

package "mysql" do
  user: sudo
  action :install
end

So this would execute sudo apt-get install mysql rather than apt-get install mysql. Can't find anything in the docs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静水深流 2024-11-21 12:00:40

通常,如果您需要 root 访问权限来配置系统,则可以在 sudo 下运行整个厨师客户端进程,而不是作为普通用户运行。

然而,社区成员创建了一个 "chef-sudo" ruby​​gem 来协助解决此问题。

Generally if you need root access to configure the system, you run the entire chef-client process under sudo, rather than as a normal user.

However, a member of the community created a "chef-sudo" rubygem to assist with this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文