1. 程式人生 > >xxx is not in the sudoers file. This incident will be reported. 問題解決

xxx is not in the sudoers file. This incident will be reported. 問題解決

參考:https://blog.csdn.net/zhu_xun/article/details/21087157

 

問題

[[email protected]_16_8_centos ~]$ sudo yum install -y git
hinzer is not in the sudoers file.  This incident will be reported.

分析與解決

原因是使用者沒有被新增到/etc/sudoers,這個配置檔案用來配置管理使用者的許可權。可以通過visudo命令來修改這個檔案配置,一定要用root管理員的身份才能修改。

1.切換root身份

[[email protected]_16_8_centos ~]$ su -

2.修改配置檔案 /etc/sudoers

[[email protected]_16_8_centos ~]# visudo
hinzer ALL=(ALL)        NOPASSWD:ALL

規則是: 誰可以使用 允許使用的主機=(以誰的身份)    可以執行的命令列表

這裡允許hinzer使用者執行所有命令,並且不用輸入密碼

 

3.切換回hinzer身份,重新安裝

[
[email protected]
_16_8_centos ~]# su - hinzer [[email protected]_16_8_centos ~]$ sudo yum install git