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

sudo

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 username

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

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:

Allow an other user to run sudo. Type the following in the command line:

sudo adduser username sudo

Or

sudo adduser username sudo

logging in as another user. Type the following in the command line:

sudo -i -u username

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.

Best Answer

When this happened to me all I had to do to fix it was:

Step 1. Open a terminal window, CTRL+ALT+T on my system (Debian KDE after setting up as hotkey)

Step 2. Entered root using command su root

Step 3. Input root password

Step 4. Input command apt-get install sudo -y to install sudo

Step 5. Add user to sudoers file by inputting adduser username sudo, put your username in place of username

Step 6. Set the correct permissions for sudoers file by inputting chmod 0440 /etc/sudoers

Step 7. Type exit and hit Enter until you close your terminal window. Shutdown your system completely and reboot.

Step 8. Open another terminal window.

Step 9. Try any sudo command to check if your username is correctly added to sudoers file. I used sudo echo "Hello World!". If your username has been correctly added to the sudoers list then you will get Hello World! as the terminal response!

Related Question