1. 程式人生 > >使用者名稱 不在 sudoers檔案中,此事將被報告。

使用者名稱 不在 sudoers檔案中,此事將被報告。

[sudo] password for lkp: 
lkp 不在 sudoers 檔案中。此事將被報告。

sudo命令可以讓你以root身份執行命令,來完成一些我們這個帳號完成不了的任務。

其實並非所有使用者都能夠執行sudo,因為有許可權的使用者都在/etc/sudoers中呢。

我們可以通過編輯器來開啟/etc/sudoers,或者直接使用命令visudo來搞定這件事情。

開啟sudoers後,像如下那樣加上自己的帳號儲存後就可以了。

## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere 
root	ALL=(ALL) 	ALL
lkp	ALL=(ALL) 	ALL

sudoers的許可權是0440,即只有root才能讀。在你用root或sudo後強行儲存(wq!)或者(x!)即可。