# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
# 针对每个用户设定权限
# 以下是指,对于root用户,不论来自何方,可以切换到本机上的所有账户,并执行所有的命令。
root ALL=(ALL) ALL
#calvin ALL=(ALL) NOPASSWD: ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
# Members of the admin group may gain root privileges
# 加上%表明针对admin这个组来设定,由于calvin属于admin组,因此如果在前面针对calvin这个用户设定了NOPASSWD:,而在这里没有设置,那么这里会覆盖之前的设置,也就是说使用sudo时还是会要求输入密码。
# 使用sudo -l可以查看自己在sudoer中的设定。
%admin ALL=(ALL) NOPASSWD: ALL
参考:
http://sial.org/howto/sudo/