oops, I think I've broken sudoers!

Asked by Steve

I was trying to add a line to sudoers file to autostart firestarter and now all I'm getting is this;
>>> sudoers file: syntax error, line 1 <<<
>>> sudoers file: syntax error, line 2 <<<
>>> sudoers file: syntax error, line 3 <<<
>>> sudoers file: syntax error, line 4 <<<
>>> sudoers file: syntax error, line 5 <<<
>>> sudoers file: syntax error, line 6 <<<
sudo: parse error in /etc/sudoers near line 1

I can't do anything that needs root access.
How do I recreate the file, or is it a re-install?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Mathias Uebelacker
Solved:
Last query:
Last reply:
Revision history for this message
tv (tom-tomvergote) said :
#1

could you post your /etc/sudoers file?

$sudo cat /etc/sudoers

Revision history for this message
Best Mathias Uebelacker (muebelacker) said :
#2

Hello Steve,

i see two possible ways.
1. Start your system with a LiveCD and try to fix the sudoers file or
2. Try to start your system in the recovery mode, that should be runlevel one. At this point you need root access so enter passwd and create a new root account.

br
Mathias

Revision history for this message
Steve (dreamspinner) said :
#3

Hello guys, thanks for the help.

TV: when I enter that command I get "access denied." any sudo gives the error above.

Mathias: I can get to the root command line but how do I create a new root account?

Thanks again,

Steve.

Revision history for this message
Mathias Uebelacker (muebelacker) said :
#4

Hello Steve,

just enter the command passwd and create a new password

br
Mathias

Am Donnerstag, den 23.08.2007, 18:39 +0000 schrieb Steve:
> Question #12009 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/12009
>
> Status: Answered => Open
>
> Steve is still having a problem:
> Hello guys, thanks for the help.
>
> TV: when I enter that command I get "access denied." any sudo gives the
> error above.
>
> Mathias: I can get to the root command line but how do I create a new
> root account?
>
> Thanks again,
>
> Steve.
>

Revision history for this message
Steve (dreamspinner) said :
#5

Ok, I've had a go and muddled through to a solution, thanks to you guys.

1) boot to the LiveCD. (7.04 in this case)

2) Open a terminal, (Application > Accessories > Terminal)

3) Enter "sudo visudo" at the prompt (this opens the visudo editor and displays the sudoers.tmp file, loaded from the CD.

4) Save the file (CNTL + o) to the original location, not the one it's targeted at now, which is on the LiveCD. In my case this was /media/disk-1/etc/sudoers. Note the missing file extension, it doesn't need the .TMP.

5) When prompted to overwrite file press y (for yes!) then CNTRL + x to exit visudo.

6) Reboot computer and boot as normal.

And that's it. At least it was for me.

Thanks for pointing me in the right direction.

Steve.

Revision history for this message
Steve (dreamspinner) said :
#6

Thanks Mathias Uebelacker, that solved my question.