假設我這裏的用戶名是 hellovim
hello
su root
chmod 0777 /etc/sudoers
vim /etc/sudoers
在 #includedir /etc/sudoers.d 追加以下內容並保存退出:code
#includedir /etc/sudoers.d
hello ALL=(ALL) NOPASSWD:ALL
注意:位置必須在#includedir /etc/sudoers.d 後面,添加在其餘地方不生效權限
chmod 0440 /etc/sudoers