1

I was in the /etc/sudoers and might done something wrong, beacuse after I couldn´t use the commandline again. Maybe i deleted sudo in /etc/sudoers. It said something was wrong i line 28. What can I do to restore this or do I have to install Ubuntu again??

1
  • 1
    First off, you should only edit /etc/sudoers with visudo. Nov 24, 2012 at 15:36

3 Answers 3

6

You can try this:

  1. Reboot the machine and choose for grub's menu "Advanced options for Ubuntu" enter image description here
  2. Then "Ubuntu, with Linux (your kernel) (recovery mode)" enter image description here
  3. after that choose "Drop to root shel prompt" enter image description here
  4. Below you will have a prompt.
  5. Make sure you have write perms in the filesystem.Type:
    mount -o remount,rw /
  6. Got to the /etc folder.Type:
    cd /etc
  7. Make sure you have write perms in the sudoers file, or type chmod 640 sudoers, then type:
    visudo
    Here you have a screenshot of the "sudoers" file. enter image description here

Maybe you have deleted the line "%sudo ALL=(ALL:ALL) ALL"
Edit the file and save the changes (ctrl+x and shift Y), change the perms of the file with to chmod 440 sudoers
Then exit and "resume normal boot"

I hope this will helpful.

Regards.

2

It is critical that you use visudo and no other method for this, or else sudo may break. Please consider reading that post to make sure you avoid the problem. In short, sudo appears to have been programmed not to work at all if the permissions of a sudoers file is not 0440. The visudo command creates files with the right permissions. By using a different method, you could temporarily wind up without administrative access (because the default umask does not create files with 0440 permissions).

Select the recovery console during the GRUB boot sequence. You can then change the permissions of the offending file so that all is normal after the next reboot. Or, if it's just a typo, you can fix that, too.

0

Easiest solution is booting into recovery mode by pressing Shift before the Ubuntu logo appears and then edit /etc/sudoers using visudo in the rescue shell.

You must log in to answer this question.

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