mona is not in the sudoers file. This incident will be reported

11,838

Solution 1

The usual way to give sudo rights to an account in Ubuntu is to add it to the admin and/or sudo groups, which are given sudo rights by default.

If you really want to modify your sudoers configuration, you should not edit /etc/sudoers directly, but add your local configuration in a separate file in the directory /etc/sudoers.d as described in man sudoers. This is to avoid the problem you just experienced: since your changes will not be in /etc/sudoers, you can safely upgrade it to newer versions without losing your configuration.

In order to modify system files if sudo won't work, you can go through recovery mode. You can then, for example, add mona to the sudo group with

usermod -aG sudo mona

Solution 2

Whoops, your "Y" accepted a new version of the sudoers file that obviously doesn't have you in it! In the future, a "D" to compare them would have been a better option, though it's also not clear that this should have happened in the first place: having your sudoers file replaced while installing software is not very professional. At this point, you'll need to log in as root (not yourself with sudo) and re-add yourself ("mona") to the Users section of the file.

Share:
11,838

Related videos on Youtube

Mona Jalal
Author by

Mona Jalal

contact me at [email protected] I am a 5th-year computer science Ph.D. Candidate at Boston University advised by Professor Vijaya Kolachalama in computer vision as the area of study. Currently, I am working on my proposal exam and thesis on the use of efficient computer vision and deep learning for cancer detection in H&E stained digital pathology images.

Updated on September 18, 2022

Comments

  • Mona Jalal
    Mona Jalal over 1 year

    So I just did a sudo apt-get upgrade and said Y to a question it asked me and now I am not a sudoer anymore. Even our root isn't a sudoer anymore. What's the solution?

    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.
    

    UPDATE: In the grub, I selected advanced options and then recovery mode -> root and changed the password using passwd mona and set the passwd however it still doesn't let me sudo after rebooting! Please suggest solutions.

    mona@pascal:~$ su -
    Password: 
    su: Authentication failure
    
    • Joshua
      Joshua over 7 years
      Wow a perfect shot into the maintainers' leg. File a bug with ubuntu when you get finished fixing this.
    • Ilmari Karonen
      Ilmari Karonen over 7 years
    • Katu
      Katu over 7 years
      @IlmariKaronen The comic doesn't show his face so... who gets the report and what does it look like?
  • steeldriver
    steeldriver over 7 years
    Worth noting that the usual way to give a user sudo access is by adding their account to the sudo group - rather than adding specific users or additional groups to the sudoers file
  • iLikeDirt
    iLikeDirt over 7 years
    That's true, yeah. Apparently Mona had her system configured differently, though your point still stands and it might be a better idea to do that.
  • iLikeDirt
    iLikeDirt over 7 years
    This is a better answer than mine, and the one you should follow.
  • Mona Jalal
    Mona Jalal over 7 years
    Please see updated question. Setting a new password for root didn't work!
  • fkraiem
    fkraiem over 7 years
    Nobody said that setting a new password would solve your problem...
  • Mona Jalal
    Mona Jalal over 7 years
    we needed what I suggested in edit mount -rw -o remount / before usermod -aG sudo mona
  • fkraiem
    fkraiem over 7 years
    It is already included in the page linked.
  • Joshua
    Joshua over 7 years
    @fkraiem: but a new root password would and that's how I interpreted that note. On having a now root password there's now 10,000 ways of fixing this.
  • Joshua
    Joshua over 7 years
    @steeldriver: That's ubuntu-specific. The usual way for sudo is to edit the sudoers file.