Ubuntu 中出现username is not in the sudoers file. This incident will be reported的错误

参考网址http://www.maketecheasier.com/fixing-sudo-error-in-ubuntu/

使用环境Ubuntu Linux系统下:

在学习鸟哥的私房菜时,使用了如下命令

<span style="font-size:18px;">usermod -G users username</span>

username为你自己的用户名。

由于没有使用-a参数导致我的用户被分到了users用户组里,而原先的用户组被重置掉,仅剩下users用户组

由于没有sudo用户组,因此无法使用sudo的命令。

解决方法:在x-windows图形界面下reboot系统

然后进入grub界面选择选中的项

选择fsck,等待30秒左右

点击root项进入root下的命令行

在命令行中输入

<span style="font-size:18px;">usermod -a -G sudo username
usermod -a -G adm username</span>

有的系统是admin,但我的系统是adm,不过我看了sudoers文件里的内容中用的是admin,

在我的/etc/group中没有admin这一项,所以我添加adm是无法让我的用户使用sudo的,因此还是要加入sudo用户组

<span style="font-size:18px;">#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

#includedir /etc/sudoers.d</span>

然后点击resume重启系统

重启后就可以进入root了。

如果你可以直接用su - 命令直接进入超级root用户,那么就可以直接修改/etc/sudoers文件

并改动username用户所属的用户组。

时间: 2024-08-28 12:01:11

Ubuntu 中出现username is not in the sudoers file. This incident will be reported的错误的相关文章

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

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

UBuntu sudo 命令 :xxx is not in the sudoers file. This incident will be reported.

[1]分析问题 提示内容翻译成中文即:用户XXX(一般是新添加的用户名称)没有权限使用sudo. 解决方法修改新用户的权限,具体操作即修改一下/etc/sudoers文件. [2]切换至root用户模式 命令:su - 备注:这里命令加有"-" ,与su是不同的. 在用命令"su"时只是切换到root,但没把root的环境变量传过去,还是当前用户的环境变量. 而用"su -"命令会将环境变量也一起切换过去(可以亲测,两个命令后分别查看环境变量$P

【Ubuntu 14.04】*** is not in the sudoers file

[email protected]:~$ sudo /opt/script/ntp.date.sh [sudo] password for junq: Sorry, try again. [sudo] password for junq: junq is not in the sudoers file.  This incident will be reported. [email protected]:~$ ***是你当前的用户名,原因是***用户没有加入到sudo的配置文件里 // 查看su

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. 编辑 sud

Ubuntu中安装eclipse,运行出错处理

在Ubuntu中安装eclipse sudo apt-get install eclipse-cdt eclipse 安装完成后,启动程序时出现错误框: An error has occurred. See the log file/home/GOOD/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/1417143109545.log. 打开文件发现错误信息: !ENTRY org.eclipse.osgi 4 0 2014

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中的django安装配置与操作

1 在对django安装(http://www.maiziedu.com/course/others/307-3024/)前,我们要确保python软件已经安装,ubuntu中默认有安装的.我们只需要安装django即可,解压django压缩文件,进入解压后的文件夹,运行,python setup.py install即可安装django到python中. 2 创建django项目,首先在任意位置创建文件夹,这里是在python用户下创建work文件夹,接着进入work运行一下命令即可创建dja

Linux/Ubuntu中添加删除新用户

操作环境:Ubuntu Server 14.04,系统上仅有一个用户root 1. adduser 命令添加新用户 #adduser username 注意adduser与useradd命令的区别,useradd是Linux系统中二进制可执行程序工具,adduser是封装了useradd之后的可执行脚本.因此adduser比useradd功能更加强大和智能,adduser在创建用户同时进行创建用户主目录等其他相关工作. 2.赋予新建用户管理员权限 只需要将用户加入sudo用户组中就可以赋予用户管

ubuntu 中安装redis

1.apt-get install redis-server 2. 检查Redis服务器系统进程 ~ ps -aux|grep redis redis 4162 0.1 0.0 10676 1420 ? Ss 23:24 0:00 /usr/bin/redis-server /etc/redis/redis.conf conan 4172 0.0 0.0 11064 924 pts/0 S+ 23:26 0:00 grep --color=auto redis 3.通过启动命令检查Redis服务