Redhat sudo简单配置一例

通过sudo可以让普通用户代替root用户的执行操作。
如:

[appadm@AS-1 conf]$ id
uid=501(appadm) gid=501(app) groups=501(app) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023[appadm@AS-1 conf]$ touch test1.log
[appadm@AS-1 conf]$ sudo touch test2.log
[appadm@AS-1 conf]$ ll
total 0
-rw-r–r–. 1 appadm app  0 Aug  6 17:41 test1.log
-rw-r–r–. 1 root   root 0 Aug  6 17:41 test2.log
[appadm@AS-1 conf]$ 

/etc/sudoers文件中增加了如下设置

Cmnd_Alias MYCMDS = /bin/ls,/bin/touch
%app        ALL=(ALL)       NOPASSWD: MYCMDS
Defaults:appadm !authenticate
 

发表评论

邮箱地址不会被公开。 必填项已用*标注

机器人检查 *

分享我的最新文章标题到这里

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据