開啟使用者sudo權限

1) 進入超級使用模式。
[xxx@localhost ~]$ su -
Password:
Last login: Sat Mar 31 11:09:36 CST 2018 on pts/2
[root@localhost ~]#

2) 添加文件的寫權限。
[root@localhost ~]# chmod u+w /etc/sudoers

3) 編輯/etc/sudoers文件。找到這【root ALL=(ALL) ALL】,在下一行添加"xxx ALL=(ALL) ALL"(這裡的xxx是你的用戶名),然後存檔(wq)。
[root@localhost ~]# vim /etc/sudoers
root ALL=(ALL) ALL
xxx ALL=(ALL) ALL

4) 添撤銷文件的寫權限。 [root@localhost ~]# chmod u-w /etc/sudoers