xxx is not in the sudoers file. This incident will be reported. 问题解决

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/feit2417/article/details/85040943

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

问题

[hinzer@VM_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身份

[hinzer@VM_16_8_centos ~]$ su -

2.修改配置文件 /etc/sudoers

[root@VM_16_8_centos ~]# visudo
hinzer ALL=(ALL)        NOPASSWD:ALL

规则是: 谁可以使用 允许使用的主机=(以谁的身份)    可以执行的命令列表

这里允许hinzer用户执行所有命令,并且不用输入密码

3.切换回hinzer身份,重新安装

[root@VM_16_8_centos ~]# su - hinzer

[hinzer@VM_16_8_centos ~]$ sudo yum install git

猜你喜欢

转载自blog.csdn.net/feit2417/article/details/85040943
今日推荐