Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I uncommented a line that says all users in the admin group are sudoers and I think that caused my problem. I'm pretty sure I corrupted the file or something.

I would show what the sudoers file looks like but it's telling me access denied.

So, my problem is that I no longer have a user with sudo abilities.

share|improve this question
up vote 4 down vote accepted

If you haven't changed the root password then you should be able to reboot and select rescue mode from the grub menu.

Or you could reboot from a livecd, mount the root partition and undo your change.

share|improve this answer
i can only ssh to the machine. Can I still select a boot option from the grub menu? – Jonathan Mayhak Feb 24 '10 at 22:23
If you don't have access to the console and you have locked yourself out of the system, then you may be out of luck. You may need to go to the box, or talk someone who has physical access to the box into fixing things for you. – Zoredache Feb 25 '10 at 0:50

In that case, you need someone with root access to modify the file to fix the issue.

Are you in the admin group?

share|improve this answer
I am in the admin group id uid=1001(jmayhak) gid=1001(jmayhak) groups=111(admin),113(ftp),1001(jmayhak),1004(developers) the problem is no one has root access anymore. and as far as I know you can't log into the machine AS root on ubuntu server – Jonathan Mayhak Feb 24 '10 at 22:24

Without looking at the resulting sudoers files, the following faults appear to be possible:

  1. In editing the sudoers file, a syntax error was introduced preventing proper operation of the file. When you change the sudoers file it is best to use visudo and not direct editing of the file.

  2. The file protections, or ownership of the sudoers file is no longer correct. The file must be owned by user: root and group: root and file protections should be: 0440 (u=r, g=r, o-rwx). Use of an editor other than visudo may leave the file with improper permissions.

To fix, a user that can attain root permissions using the root password (via su) is needed. If you have physical access to the machine you can boot rescue boot and fix the problem as well using a Linux CD. Of course, if you have physical access to the machine, in many companies and situations you would have the root password anyway so using the rescue boot would not be necessary.

share|improve this answer
If I put in a linux cd and run in recovery mode...what do I do next? Will I be able to open the sudoers file in recovery mode? – Jonathan Mayhak Feb 25 '10 at 15:50
In recovery mode, mount the root disk to /mnt, then you can edit the file found under /mnt – mdpc Feb 25 '10 at 18:18

If you still have access to the box in someway, you could possibly use a local privilege escalation attack to gain root access and fix the the problem with sudo (or sudo su -c passwd).

Mind you trying this yourself could well hose your box or leave it in a working but unstable state, get someone experience to try it for you or find a way to get local access and use a livecd to reset the password.

share|improve this answer

Your Answer


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.