linux – Ansible adhoc命令用sudo执行

linux – Ansible adhoc命令用sudo执行,第1张

概述我需要执行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. 我需要执行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.

总结

以上是内存溢出为你收集整理的linux – Ansible adhoc命令用sudo执行全部内容,希望文章能够帮你解决linux – Ansible adhoc命令用sudo执行所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1035862.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存