增加可以 reboot 的 myuser
$ adduser myuser
$ sudo gpasswd -a myuser sudo
$ echo "myuser ALL = NOPASSWD: /usr/sbin/reboot" | sudo tee /etc/sudoers.d/60_myuser
$ sudo chmod 0440 /etc/sudoers.d/60_myuser
若不幸輸入錯字,會產生如下錯誤
>>> /etc/sudoers: syntax error near line 24 <<<
sudo: parse error in /etc/sudoers near line 24
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
使用下列方法修復
$ pkexec visudo
What now? 會停在此處,別怕按下 Enter
Options are:
(e)dit sudoers file again
e(x)it without saving changes to sudoers file
(Q)uit and save changes to sudoers file (DANGER!)
沒有留言:
張貼留言