栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

xxx is not in the sudoers file.This incident will be reported.的解决方法

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

xxx is not in the sudoers file.This incident will be reported.的解决方法

新装的虚拟机用户没有sudo权限会弹出以下警告,无法用root权限去更新yum

执行sudo yum -y update的时候

[sandwich@192 ~]$ sudo yum -y update

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for sandwich: 
sandwich is not in the sudoers file.  This incident will be reported.

这时候需要给sandwich这个用户分配sudo权限,请follow以下步骤吧

1.切换回root用户
[sandwich@192 ~]$ su root
Password: 
2.添加sudo文件的写权限
[root@192 sandwich]# chmod u+w /etc/sudoers
3.给sudoers文件添加新用户

vi /etc/sudoers

找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)
ps:这里说下你可以sudoers添加下面四行中任意一条

#允许用户yuser执行sudo命令(需要输入密码).
user            ALL=(ALL)                ALL
#允许用户组user里面的用户执行sudo命令(需要输入密码).
%user           ALL=(ALL)                ALL
#允许用户user执行sudo命令,并且在执行的时候不输入密码.
user            ALL=(ALL)                NOPASSWD: ALL
#允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.
%user           ALL=(ALL)                NOPASSWD: ALL
4.取消sudoers文件的写权限

[root@192 sandwich]# chmod u-w /etc/sudoers

这样新用户就可以使用sudo了。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/361021.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号