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

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:

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.

3

4 Answers

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, ]

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
2
  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.

1

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.

2

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)
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like