添加用戶and授權root
adduser tom #創建用戶
passwd tom #設置密碼
chmod u+w /etc/sudoers #加可編輯權限
#授權root
vim /etc/sudoers
添加如下內容‘tom ALL=(ALL) NOPASSWD:ALL’ 在 ‘root ALL=(ALL) ALL’的下一行
Allow root to run any commands anywhere
root ALL=(ALL) ALL
tom ALL=(ALL) NOPASSWD:ALL
chmod u-w /etc/sudoers #去掉可編輯權限
重新啓動一下即可