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

2

1

I am running Ubuntu 12.04 on my laptop using VMware Player. I am not sure why but I have an account called "User Account" in addition to my account that I usually login to use Ubuntu. Well that was just a side comment but basically all I am trying to do is install the ncurses library on Ubuntu. I have tried installing ncurses using the following command lines:

sudo apt-get install libncurses5-dev
sudo apt-get install ncurses-dev

When I tried installing ncurses twice using the above commands I received the following prompt in the terminal:

[sudo] password for fsolano:

where fsolano is my username, so if you like the above line can be expressed more generically as

[sudo] password for username:

When I type in my password I receive the following message:

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

or more generically,

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

So far I have tried enabling the root user ("Super User") account by following the instructions at this link: https://help.ubuntu.com/community/RootSudo

Here are some of the things the link suggested to do:

  1. Allow another user to run sudo. Type the following in the command line:

    sudo adduser username sudo
  2. lLogging in as another user. Type the following in the command line:

    sudo -i -u username
  3. Enabling the root account. Type the following in the command line:

    sudo -i
    

    or

    sudo passwd root
    

I have tried all of the above command lines and after typing in each command I was prompted for my password. After I entered my password I received the same message as when I tried to install ncurses:

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

If anyone can help I would greatly appreciate it.

fsolano94

Posted 2015-01-19T10:37:29.093

Reputation: 121

You need to add yourself to /etc/sudoers. Here's how: Ubuntu Docs: Sudoers. To get yourself better acquainted with Linux, I highly recommend taking this free online course: LFS101x.2: Introduction to Linux

– Vinayak – 2015-01-20T10:23:30.087

Duplicated on another Stack Exchange: http://unix.stackexchange.com/questions/179954/

– JdeBP – 2015-01-20T14:23:45.290

1

Very relevant XKCD: http://imgs.xkcd.com/comics/incident.png

– Jarmund – 2016-06-25T22:07:57.433

Answers

4

Can any of your users run sudo successfully? You'll need to log in as one of them, then run the sudo adduser username sudo for the username's you want to be able to run sudo.

Or, if none of your users can run sudo, you could boot into "Recovery mode" from grub (hold shift while booting, if your grub menu doesn't show up automatically, or adding single to the linux ... initrd ... quiet splash line), then:

mount -o rw,remount /
adduser username sudo

Running adduser for each user you want to be able to sudo. Then exit & resume. [From instructions linkd at the bottom of your help link, http://www.psychocats.net/ubuntu/fixsudo ]

There are other solutions if you can't get to Recovery mode, maybe with a live dvd & creative mounting & chroot, or editing files by hand. And if your sudoers files (/etc/sudoers*) are messed up that's something else that can be fixed from the psychocats.net link too. Like editing your hard drive's /etc/sudoers file to include a line that lets fsolano use sudo, like:

fsolano    ALL=(ALL:ALL) ALL

Xen2050

Posted 2015-01-19T10:37:29.093

Reputation: 12 097

So far none of the users can run sudo successfully, and that one user account I mentioned (which is just called "user") is the Root user account. I just dont know or remember the password for that account. Thanks for all of your help thus far. I am going to try everything you have suggested and then I'll post my results on here. Thanks! – fsolano94 – 2015-01-19T20:41:44.577

@fsolano94 I edited a bit more about getting into single user mode (add single to the kernel/boot line). And editing the /etc/sudoers files from a live dvd – Xen2050 – 2015-01-20T10:22:46.913

1

  1. Open a terminal and type this command

    # pkexec visudo
    
  2. Enter the root password

  3. Edd the following line to sudoers file

    after this line

    root    ALL=(ALL) ALL
    

    add this line

    username   ALL=(ALL)ALL
    

This worked for me. Then try to log in as root and type this command

# sudo -s

Enter the root password and go on.

Ahmed Mahmoud

Posted 2015-01-19T10:37:29.093

Reputation: 111

It's been mentioned a few times that the OP doesn't know the root password. – Scott – 2016-06-25T21:55:30.327

0

This worked like a charm in Redhat for me:

su
cd /etc
ls -l
chmod +w sudoers

gedit sudoers

Scroll down in file and find line (root ALL=(ALL) ALL)

Right there add this for the user (example userid: roman)

root ALL=(ALL) ALL
roman ALL=(ALL) ALL

Exit & Save


chmod -w sudoers   # (make the sudoers READ-ONLY again)

Madhurya Gandi

Posted 2015-01-19T10:37:29.093

Reputation: 101

1OP mentioned in the comments that he doesn't know the root password and has no account that can run sudo successfully. I don't understand how do you expect him to run su without knowing the root password? – Adalee – 2016-04-27T10:54:21.557

0

This issue is simple there is no entry for fsolano in /etc/sudoers file.

May be with root user, execute following command : visudo

Above command will open the file for editing then give permissions to fsolano for executing sudo command.

shubham

Posted 2015-01-19T10:37:29.093

Reputation: 111

Well as silly as this may sound, I do not know or remember my admin (Root) user password. Do you know if there is another way to give permissions to fsolano using sudo commands? – fsolano94 – 2015-01-19T20:35:17.270

I think that root access is necessary. You may try resetting the root password though by using single user mode. May be below link will help for this :http://askubuntu.com/questions/132965/how-do-i-boot-into-single-user-mode-from-grub or http://tarunlinux.blogspot.jp/2014/02/ubuntu-1204-grub-to-boot-into-single.html

– shubham – 2015-01-20T01:31:55.730