Centos怎么配置sudo用户

发布时间:2021-08-17 12:35 来源:亿速云 阅读:0 作者:chen 栏目: 服务器 欢迎投稿:712375056

本篇内容介绍了“Centos怎么配置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.

当前需要做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.

只需要将对应用户的行设置 NOPASSWD即可实现无密码sudo

免责声明:本站发布的内容(图片、视频和文字)以原创、来自本网站内容采集于网络互联网转载等其它媒体和分享为主,内容观点不代表本网站立场,如侵犯了原作者的版权,请告知一经查实,将立刻删除涉嫌侵权内容,联系我们QQ:712375056,同时欢迎投稿传递力量。