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