1. 程式人生 > >linux使用者新增sudo命令許可權

linux使用者新增sudo命令許可權

xxx is not in the sudoers file.This incident will be reported.的解決方法轉載自:http://www.cnblogs.com/zox2011/archive/2013/05/28/3103824.html1.切換到root使用者下,怎麼切換就不用說了吧,不會的自己百度去.2.新增sudo檔案的寫許可權,命令是:chmod u+w /etc/sudoers3.編輯sudoers檔案vi /etc/sudoers找到這行 root ALL=(ALL) ALL,在他下面新增xxx ALL=(ALL) ALL (這裡的xxx是你的使用者名稱)ps:這裡說下你可以sudoers新增下面四行中任意一條youuser ALL=(ALL) ALL%youuser ALL=(ALL) ALLyouuser ALL=(ALL) NOPASSWD: ALL%youuser ALL=(ALL) NOPASSWD: ALL第一行:允許使用者youuser執行sudo命令(需要輸入密碼).第二行:允許使用者組youuser裡面的使用者執行sudo命令(需要輸入密碼).第三行:允許使用者youuser執行sudo命令,並且在執行的時候不輸入密碼.第四行:允許使用者組youuser裡面的使用者執行sudo命令,並且在執行的時候不輸入密碼.4.撤銷sudoers檔案寫許可權,命令:chmod u-w /etc/sudoers這樣普通使用者就可以使用sudo了.