# /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用戶,不論來自何方,可以切換到本機上的所有賬戶,并執(zhí)行所有的命令。
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/