盐仆如何用sudo提升非根用户?

2024-10-01 13:45:15 发布

您现在位置:Python中文网/ 问答频道 /正文

当我尝试以非根用户身份运行仆从时,出现权限被拒绝的错误。我创建了一个名为“salt master”的特殊用户,并赋予它sudo特权。然而,我仍然看到许可被拒绝的错误。我在同一台服务器上使用salt master和minion进行测试,否则客户端的用户名将被命名为salt minion。我怎样才能得到盐来使用sudo?在

/etc/sudoers公司

# salt-master user allowed root with no password
salt-master ALL=(ALL) NOPASSWD:ALL

/etc/盐/仆从

^{pr2}$

/srv/salt/gedit/初始化.sls在

gedit:
  pkg:
    - installed

命令

salt 'SaltStack-01' state.sls gedit

命令结果

SaltStack-01:
----------
          ID: gedit
    Function: pkg.installed
      Result: False
     Comment: The following packages failed to install/update: gedit.
     Changes:   

Summary
------------
Succeeded: 0
Failed:    1
------------
Total:     1

仆从日志/var/log/salt/minion

2014-09-17 13:35:05,199 [salt.loaded.int.module.cmdmod][ERROR] Command 'zypper refresh' failed with return code: 5
2014-09-17 13:35:05,200 [salt.loaded.int.module.cmdmod][ERROR] output: Root privileges are required for refreshing system repositories.
2014-09-17 13:35:05,243 [salt.loaded.int.module.cmdmod][ERROR] Command 'zypper --non-interactive install --name --auto-agree-with-licenses "gedit"' failed with return code: 5
2014-09-17 13:35:05,244 [salt.loaded.int.module.cmdmod][ERROR] output: Root privileges are required for installing or uninstalling packages.

Tags: 用户master错误witherrorallintsalt
1条回答
网友
1楼 · 发布于 2024-10-01 13:45:15

http://docs.saltstack.com/en/latest/ref/configuration/nonroot.html

引用 仆从也有自己的用户参数,但是以非特权用户身份运行仆从将阻止它对用户、已安装的软件包等进行更改,除非在仆从上设置了访问控制(sudo等),以允许非root用户进行所需的更改。在

为了允许Salt以非根用户的身份成功运行,需要设置所有权和权限,以便所需的用户可以读取和写入以下目录(及其子目录,如果适用):

相关问题 更多 >