sudoers配置

sudoers的缺省配置: 
#############################################################

## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
##  user MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root ALL=(ALL)  ALL

## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS

## Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Allows members of the users group to mount and unmount the
## cdrom as root
# %users  ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now

##########################################################

1. 让普通用户admin具有root的所有权限 
执行visudo之后,可以看见缺省只有一条配置: 
root    ALL=(ALL) ALL 
那么你就在下边再加一条配置: 
admin ALL=(ALL) ALL 
这样,普通用户admin就能够执行root权限的所有命令 
以admin用户登录之后,执行: 
sudo su - 
然后输入admin用户自己的密码,就可以切换成root用户了 

2. 让用户admin和apache拥有部分命令的root权限,并且不需要输入密码

admin ALL= NOPASSWD: /usr/local/www/scripts/
apache ALL= NOPASSWD: /usr/local/www/scripts/,/usr/local/bin/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值