加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – Ansible adhoc命令用sudo执行

发布时间:2020-12-14 02:49:27 所属栏目:Linux 来源:网络整理
导读:我需要执行ansible adhoc命令. $ansible somehost -m command -a "cat /etc/passwd"-u someuser --ask-sudo-pass 我有一个具有sudo权限的用户帐户(someuser).通常我成了根sudo su – . 如何在sudo su中使用adhoc命令 – ? ansible版本是2.0.0.2 解决方法 对
我需要执行ansible adhoc命令.
$ansible somehost -m command -a "cat /etc/passwd"-u someuser --ask-sudo-pass

我有一个具有sudo权限的用户帐户(someuser).通常我成了根sudo su – .

如何在sudo su中使用adhoc命令 – ?

ansible版本是2.0.0.2

解决方法

对于Ansible 1.9或更高版本,您需要使用–ask-become-pass.对于旧版本–ask-sudo-pass应该可以工作.

Become (Privilege Escalation)

Before 1.9 Ansible mostly allowed the use of sudo and a limited use of
su to allow a login/remote user to become a different user and execute
tasks,create resources with the 2nd user’s permissions. As of 1.9
become supersedes the old sudo/su,while still being backwards
compatible. This new system also makes it easier to add other
privilege escalation tools like pbrun (Powerbroker),pfexec,dzdo (Centrify),and others.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读