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??
3 Answers
You can try this:
- Reboot the machine and choose for grub's menu "Advanced options for Ubuntu"
- Then "Ubuntu, with Linux (your kernel) (recovery mode)"
- after that choose "Drop to root shel prompt"
- Below you will have a prompt.
- Make sure you have write perms in the filesystem.Type:
mount -o remount,rw /
- Got to the /etc folder.Type:
cd /etc - 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.
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.
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.
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.
visudo
.