佚名 通过本文向大家介绍了centos sudo,centos sudo命令,添加sudo用户,ubuntu添加sudo用户,sudo 切换用户等相关知识,希望对您有所帮助,也希望大家多多支持微课江湖
使用visudo命令进行sudo配置文件的编写
## The COMMANDS section may have other options added to it. ## ## Allow root to run any commands anywhere root ALL=(ALL) ALL ansible ALL=(ALL) ALL ## Allows members of the 'sys' group to run networking, software, ## service management apps and more.</div>
当前需要做sudo的用户为ansible,即将其添入root行下方
保存退出即可
免密码sudo
## The COMMANDS section may have other options added to it. ## ## Allow root to run any commands anywhere root ALL=(ALL) ALL ansible ALL=(ALL) NOPASSWD:ALL ## Allows members of the 'sys' group to run networking, software, ## service management apps and more.</div>
只需要将对应用户的行设置 NOPASSWD即可实现无密码sudo
</div>