标签:option use for linux基础 edit table VID command drop
sudo允许用户以其他用户的身份(比如root)执行命令,比如切换用户、执行命令、读写文件等;
sudo配置在:/etc/sudoers
## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.
##
## This file must be edited with the ‘visudo‘ command.
...
## 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
...
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
从这个配置文件可以看到3点:
username ALL=(root) NOPASSWD: /bin/su - targetuser
允许username切换到targetuser
%groupname ALL=(root) NOPASSWD: /bin/su - targetuser
允许groupname里边的用户切换到targetuser
username ALL=(root) NOPASSWD: /usr/sbin/iptables
允许username执行iptables命令
标签:option use for linux基础 edit table VID command drop
原文地址:https://www.cnblogs.com/barneywill/p/10272455.html