Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92520531
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: LINUX

2008-04-29 15:03:45

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,可以了

阅读(303) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~