Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was trying to install some software/edit files with my main username(not root) But I got this error [X] is not in the sudoers file. This incident will be reported.
I tried to edit the /etc/sudoers file by using sudo and su username but I got the same error!

How I'm supposed to add my username tosudoers file while I cant access it anyway?
I also tried to follow this guide here.

is the guide says, when booting 2 Operating systems(that's my case), then selecting Ubuntu, a menu will let you choose to start normally/open recovery mode/etc, but it's not happening for me, even if I hold shift no menu will pop up.

I installed Ubuntu by using Wubi and my Ubuntu version:12.04 LTS.

share|improve this question
    
That guide looks pretty good for dealing with your sudo problem, and would probably work if you could follow it. I think you need to change your question to be "How can I boot into recovery mode?" and then ask about sudo if following that guide does not fix the problem. –  David Edwards Jun 15 '12 at 10:53
    
To boot into recovery mode, restart the PC and hold down the Shift button, then follow the instructions - psychocats.net/ubuntu/fixsudo –  scouser73 Jun 15 '12 at 11:24
    
you will not get the Grub menu for a wubi install. If you have any other user account you can access, which has permissions to edit sudoers file, that may help. Else, you may have to use external tools for that. It certainly can be solved. :) –  Mahesh Jun 15 '12 at 11:30

3 Answers 3

up vote 19 down vote accepted

Open a Root Terminal and type visudo (to access and edit the list).

Navigate to the bottom of the sudoers file that is now displayed in the terminal.

Just under the line that looks like the following:

    root ALL=(ALL) ALL

Add the following (replacing user with your actual username):

    user ALL=(ALL) ALL

Now save the file. The procedure for this will depend on your editor:

  • nanoCtrlO then Enter, then CtrlX to exit
  • vim:wq
share|improve this answer
2  
His problem is in accessing a root terminal. And, you assumed that his editor is nano. Kindly improve it. –  Mahesh Jun 15 '12 at 11:31
2  
How can he open a Root Terminal without giving root password which is not working? –  Anwar Shah Jun 15 '12 at 11:50
1  
You can easily find some online tutorial to retrieve/change your root password and you'll be able to open a standard terminal and give su to become root. Otherwise, you may want to boot with a Live CD and access the file after having mounted the HD. Finally, I wasn't referring to nano. visudo is included in standard Ubuntu installation. –  jasmines Jun 15 '12 at 12:03
    
Ctrl + K then X worked. –  Fredrick Gauss Jun 5 at 14:45

If you have the root password (may have been configured during installation), you can open a terminal and type su -l, then the root password. Lastly follow jasmines answer. To start edit in vim, go to the line below root ALL=(ALL) ALL and press i. I was able to follow these steps to add my account after an initial Fedora install.

share|improve this answer

the process described at search: "psychocats ubuntu fixsudo" helped me on Lubuntu 13.04

Enter recovery mode then

mount -o rw,remount /

adduser username sudo
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.