ubuntu:xxx is not in the sudoers file. 问题解决

ubuntu 下普通用户用 sudo 执行命令时报 "xxx is not in the sudoers file.This incident will be reported" 错误,解决方法是在 /etc/sudoers 文件里给该用户添加权限。操作过程如下:

1. 切换到 root 用户下

2. /etc/sudoers 文件默认是只读的,对 root 来说也是,因此需先添加 sudoers 文件的写权限,命令是:
    chmod u+w /etc/sudoers

3. 编辑 sudoers 文件
    vi /etc/sudoers

找到这行 root ALL=(ALL) ALL,在他下面添加
    xxx ALL=(ALL) ALL (这里的 xxx 是你的用户名)

PS:这里说下你可以 sudoers 添加下面四行中任意一条

/*******************************************/
youuser     ALL=(ALL)   ALL
%youuser    ALL=(ALL)   ALL
youuser     ALL=(ALL)   NOPASSWD: ALL
%youuser    ALL=(ALL)   NOPASSWD: ALL

第一行:允许用户 youuser 执行 sudo 命令(需要输入密码)。
第二行:允许用户组 youuser 里面的用户执行 sudo 命令(需要输入密码)。
第三行:允许用户 youuser 执行 sudo 命令,并且在执行的时候不输入密码。
第四行:允许用户组 youuser 里面的用户执行 sudo 命令,并且在执行的时候不输入密码。
/*******************************************/

4.撤销 sudoers 文件写权限,命令:
    chmod u-w /etc/sudoers

原文地址:https://www.cnblogs.com/GyForever1004/p/10436414.html

时间: 2024-08-30 01:58:01

ubuntu:xxx is not in the sudoers file. 问题解决的相关文章

Ubuntu下is not in the sudoers file 问题解决

在Ubuntu12.04 下,使用sudo apt-get install XXX 时,突然跳出 username is not in the sudoers file的问题 然后我一查此username的类型,果然是标准用户而不是管理员用户 解决这个问题至少有两种方法: 一.System Settings ->User Accounts -> 点击Unlock ->输入root密码 -> 修改AccountType(用户类型)为Administrator(管理员) -> 重

Ubuntu——"xxx is not in the sudoers file.This incident will be reported" 错误解决方法

Ubuntu下普通用户用sudo执行命令时报如题所示错误,解决方法就是在/etc/sudoers文件里给该用户添加权限.如下: 1.切换到root用户下 2./etc/sudoers文件默认是只读的,对root来说也是,因此需先添加sudoers文件的写权限,命令是:chmod u+w /etc/sudoers 3.编辑sudoers文件vi /etc/sudoers找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名) ps

xxx is not in the sudoers file 和 Authority XXX 不能sudo解决方法

大致的场景是这样的: 系统中只有一个用户,不知进行了什么样的修改,导致这个用户获得不了root权限(先前是正常的)(据说是将这个用户加入了root组造成的,具体原因不明) 当这个用户想要用到root权限来进行相关操作的时候(执行sudo)系统显示: XXX is not in the sudoers file. This incident will be reported. 网上查找到相关的解决办法,是要修改/etc/sudoers文件,但是这个文件的修改是需要root权限的 想要获得root权

centos添加和删除用户及 xxx is not in the sudoers file.This incident will be reported.的解决方法

1.添加用户,首先用adduser命令添加一个普通用户,命令如下: #adduser tommy //添加一个名为tommy的用户 #passwd tommy   //修改密码 Changing password for user tommy. New UNIX password:     //在这里输入新密码 Retype new UNIX password:  //再次输入新密码 passwd: all authentication tokens updated successfully.

Error prompt:“xxx is not in the sudoers file”----Solution

//Situation    System prompts "xxx is not in the sudoers file"(xxx equals the user name) while executing command "sudo": sudo -i Password: xxx is not in the sudoers file. This incident will be reported. //Analysis    The current accoun

用sudo时提示"xxx is not in the sudoers file. This incident will be reported.

现象: 非Root用户在使用sudo命令时,提示:"xxx is not in the sudoers file. This incident will be reported.(xxx为用户名) 解决办法: 使用 su – root 切换到root用户,编辑sudoers文件 vim /etc/sudoers找到"root ALL=(ALL)"在此行下面添加一行 "xxx ALL=(ALL) ALL" //xxx 为用户名 保存即可.

CentOS7──xxx is not in the sudoers file

提示"xxx is not in the sudoers file. This incident will be reported.其中 "XXX"是你的用户名,也就是你的用户名没有权限使用sudo,我们只要修改一下/etc/sudoers文件就行了. 下面是修改方法: 1)进入超级用户模式.打开'Open Terminal' 输入"su",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式.(当然,你也可以直接用root权限) 2)添加文件的写权

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

Linux中普通用户用sudo执行命令时报"xxx is not in the sudoers file.This incident will be reported"错误,解决方法就是在/etc/sudoers文件里给该用户添加权限.如下: 1.切换到root用户下  方法为直接在命令行输入:su,然后输入密码(即你的登录密码,且密码默认不可见). 2./etc/sudoers文件默认是只读的,对root来说也是,因此需先添加sudoers文件的写权限,命令是: 即执行操作:chmo

企业运维案例:xxx is not in the sudoers file.This incident will be reported” 错误解决方法

CentOS6系统下,普通用户使用sudo执行命令时报错: xxx is not in the sudoers file.This incident will be reported" 解决方法就是在/etc/sudoers文件里给该用户添加权限.如下: 1.切换到root用户下 2./etc/sudoers文件默认是只读的,对root来说也是,因此需先添加sudoers文件的写权限,命令是:chmod u+w /etc/sudoers 3.编辑sudoers文件vim /etc/sudoers