0%

Fix "xxx is not in the sudoers file" in linux

在Linux常常遇到這種情況,記錄一下。
使用sudo執行指令的時候,常常會xxx is not in the sudoers file. This incident will be reported.
表示你的用戶沒有權限使用sudo,必須修改/etc/sudoers這個文件,修改方式如下。

  1. 進入Super user mode

    1
    $ su -
  2. 修改文件權限

    1
    $ chmod u+x  /etc/sudoers
  3. 修改/etc/sudoers內容,在root ALL=(ALL) ALL底下加上一行且存檔。

    1
    xxx ALL=(ALL) ALL

    這裡的xxx就是你的用戶名稱

  4. 回復文件權限

    1
    $ chmod u-x  /etc/sudoers