美文网首页
给用户sudo权限

给用户sudo权限

作者: 冰T弦 | 来源:发表于2019-03-22 13:25 被阅读0次

我使用的是centos7.5,切换到root用户执行

1、修改/etc/sudoers文件权限,默认只读,给属主添加写入权限:
[root@node1 ~]# chmod u+w /etc/sudoers
2、编辑/etc/sudoers文件
[root@node1 ~]# vi /etc/sudoers
向其中加入以下红色部分:
\color{red}{puser ALL=(ALL) NOPASSWD:ALL}

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
puser  ALL=(ALL)       NOPASSWD:ALL
## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS


## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

其中puser为需要添加sudo权限的用户名称,此处设置为不需要密码验证。

相关文章

网友评论

      本文标题:给用户sudo权限

      本文链接:https://www.haomeiwen.com/subject/vwvlvqtx.html