$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执行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)