【问题标题】:Can I run cloud init as a different user than root?我可以以不同于 root 的用户身份运行 cloud init 吗?
【发布时间】:2021-12-16 06:41:56
【问题描述】:

由于使用 git 时的权限问题,我试图以不同于 root 的用户身份运行 cloud init。有没有这样的方法?

【问题讨论】:

  • xyproblem.info 所以真正的问题是权限问题。您应该询问该问题,而不是您选择的解决方案遇到的问题
  • 实际上,没有。 cloud-init 对其尝试执行的许多操作都需要 root 权限。

标签: linux cloud-init


【解决方案1】:

使用git时的权限问题

如果尝试在 runcmd module 中运行 git 命令,您可以使用 su 选择以哪个用户身份运行命令。

考虑:

root# su <target user> -c "whoami"
<target user>

我还没有测试过,但是在你的云配置中这样的东西可能会起作用:

runcmd:
 - [su, myuser, -c, "git clone <repo> <directory>"]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-07
    • 2010-09-08
    • 1970-01-01
    • 1970-01-01
    • 2020-02-14
    • 1970-01-01
    相关资源
    最近更新 更多