Defaults requiretty
#默认需要一个真实的tty才能运行sudo,安全考虑,会影响到远程命令和crontab
Defaults:nclogs !requiretty
#默认取消一个用户的该安全设置
Defaults env_reset
#默认重置环境变量
Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \
LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
_XKB_CHARSET XAUTHORITY"
#默认保持的环境变量
root ALL=(ALL) ALL
ncadmin ALL=(ALL) NOPASSWD: ALL
#某个高级用户,默认所有命令的sudo都不需要密码
Cmnd_Alias LOGS = /usr/bin/less, /bin/ls, /bin/grep, /bin/cat, /usr/bin/lastlog, /usr/bin/last, /usr/bin/top, /sbin/iptables, /bin/netstat, /bin/df, /usr/bin/tail, /usr/bin/crontab, /sbin/fuser
nclogs ALL = NOPASSWD: LOGS
#设置一个命令集关联到LOGS,并赋予nclogs这个帐号,并输入这些命令时,不需要密码
Host_Alias CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
User_Alias PARTTIMERS = bostley, jwfox, crawl
Defaults:PARTTIMERS [!]flags_name
#具体可以man sudoers
阅读(1633) | 评论(0) | 转发(0) |