mona不在sudoers文件中。 将报告此事件

所以我只是做了一个sudo apt-get upgrade并且说Y问了一个问题,现在我不再是sudoer了。 甚至我们的根也不再是一个sudoer了。 解决方案是什么?

 Configuration file '/etc/sudoers' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** sudoers (Y/I/N/O/D/Z) [default=N] ? Y Installing new version of config file /etc/sudoers ... Setting up apt-transport-https (1.0.1ubuntu2.15) ... Setting up libisc95 (1:9.9.5.dfsg-3ubuntu0.10) ... Setting up libdns100 (1:9.9.5.dfsg-3ubuntu0.10) ... Setting up libisccc90 (1:9.9.5.dfsg-3ubuntu0.10) ... Setting up libisccfg90 (1:9.9.5.dfsg-3ubuntu0.10) ... Setting up libbind9-90 (1:9.9.5.dfsg-3ubuntu0.10) ... Setting up liblwres90 (1:9.9.5.dfsg-3ubuntu0.10) ... Setting up bind9-host (1:9.9.5.dfsg-3ubuntu0.10) ... Setting up dnsutils (1:9.9.5.dfsg-3ubuntu0.10) ... Setting up dbus (1.6.18-0ubuntu4.4) ... Installing new version of config file /etc/dbus-1/system.conf ... Setting up python3-update-manager (1:0.196.22) ... Setting up update-manager-core (1:0.196.22) ... Setting up bazel (0.4.0) ... Setting up cuda-repo-ubuntu1404 (8.0.44-1) ... OK Setting up dbus-x11 (1.6.18-0ubuntu4.4) ... Setting up dkms (2.2.0.3-1.1ubuntu5.14.04.9) ... Setting up firefox (49.0.2+build2-0ubuntu0.14.04.1) ... Please restart all running instances of firefox, or you will experience problems. Setting up libxnvctrl0 (361.93.02-0ubuntu1) ... Setting up linux-generic-lts-saucy (3.13.0.100.108) ... Setting up linux-headers-generic-lts-saucy (3.13.0.100.108) ... Setting up linux-image-generic-lts-saucy (3.13.0.100.108) ... Setting up linux-libc-dev:amd64 (3.13.0-100.147) ... Setting up linux-tools-common (3.13.0-100.147) ... Setting up python-pil (2.3.0-1ubuntu3.3) ... Setting up python-imaging (2.3.0-1ubuntu3.3) ... Processing triggers for libc-bin (2.19-0ubuntu6.9) ... mona@pascal:~/computer_vision/deep_learning/ssd/caffe$ sudo apt-get install build-essential cmake git pkg-config mona is not in the sudoers file. This incident will be reported. mona@pascal:~$ pwd /home/mona mona@pascal:~$ su - Password: su: Authentication failure mona@pascal:~$ sudo passwd root [sudo] password for mona: mona is not in the sudoers file. This incident will be reported. 

更新:在grub中,我选择了高级选项,然后选择了恢复模式 – > root并使用passwd mona更改了密码并设置了passwd但是重启后它仍然不让我sudo! 请建议解决方案。

 mona@pascal:~$ su - Password: su: Authentication failure 

在Ubuntu中为帐户提供sudo权限的通常方法是将其添加到admin和/或sudo组,默认情况下这些组具有sudo权限。

如果你真的想修改你的sudoers配置,你不应该直接编辑/etc/sudoers ,而是将你的本地配置添加到/etc/sudoers.d目录中的单独文件中,如man sudoers 。 这是为了避免您刚刚遇到的问题:由于您的更改不在/etc/sudoers ,因此您可以安全地将其升级到较新版本而不会丢失配置。

如果sudo不起作用,为了修改系统文件,您可以进入恢复模式 。 然后,您可以使用添加monasudo

 usermod -aG sudo mona 

哎呀,你的“Y”接受了sudoers文件的新版本,显然没有你的! 在将来,比较它们的“D”本来是一个更好的选择,虽然也不清楚这应该是首先发生的:在安装软件时更换你的sudoers文件不是很专业。 此时,您需要以root身份登录(而不是使用sudo登录)并将自己(“mona”)重新添加到文件的Users部分。

你可以使用这样的命令:

 sudo gpasswd -a username sudo 

代替username ,将要添加的用户名添加到sudo组。 如果你运行sudo gpasswd -a mono sudo ,它会为mono用户提供sudo权限,并且由于-a选项,实际上会将该用户添加到sudo组。