2

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.

3

4 Answers 4

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
2
  • 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
    Jan 19, 2015 at 20:41
  • @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
    Jan 20, 2015 at 10:22
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.

2
  • 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
    Jan 19, 2015 at 20:35
  • 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 :askubuntu.com/questions/132965/… or tarunlinux.blogspot.jp/2014/02/…
    – shubham
    Jan 20, 2015 at 1:31
0
  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
-1

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
  • 1
    OP 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
    Apr 27, 2016 at 10:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .