sudo可以直接运行/etc/sudoers 里设置许可以的令命
如查要作修改:
1:修改其属性
[root@ecofe2 root]#chmoe 740 /etc/sudoers
2:修改sudoers文件
[root@ecofe2 root]#vi /etc/sudoers
3:修改其内容如下:
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# Defaults specification
# User privilege specification
root ALL=(ALL) ALL
#下面的save用户在运行后面充许的程序不用输入密码
#就是要输入密码,也是本用户的密码,而不是级超用户的密码
save ALL=(ALL) NOPASSWD:ALL
# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
# Samples例子
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom 这个那当前用可以运行此命行
#%users localhost=/sbin/shutdown -h now
#save用户被充许重启计算机
save localhost=/sbin/reboot
4:存退出!再改会/etc/sudoers属性为440
[root@ecofe2 root]#chmoe 440 /etc/sudoers
5:以save用户登录
login as: save
password:
-bash-2.05b$ sudo reboot
OK,可以了