0

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.

4 Answers 4

4

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.

2
  • i can only ssh to the machine. Can I still select a boot option from the grub menu? Feb 24, 2010 at 22:23
  • 1
    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, 2010 at 0:50
0

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

Are you in the admin group?

1
  • 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 Feb 24, 2010 at 22:24
0

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.

2
  • 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? Feb 25, 2010 at 15:50
  • In recovery mode, mount the root disk to /mnt, then you can edit the file found under /mnt
    – mdpc
    Feb 25, 2010 at 18:18
0

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.

You must log in to answer this question.

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