How do I edit an invalid visudo file?
Here is what happens:
$ sudo visudo
>>> /etc/sudoers: syntax error near line 28 <<<
sudo: parse error in /etc/sudoers near line 28
sudo: no valid sudoers sources found, quitting
|
How do I edit an invalid visudo file? Here is what happens:
|
||||
|
|
|
On a modern Ubuntu system (and many other GNU/Linux distributions), fixing a corrupted To do this via SSH, log in to the machine and run the command (If there is more than one user account on the system authorized to run programs as If that doesn't work--for example, if there are no users authorized to run programs as root via PolicyKit--then boot from an Ubuntu live CD (like the CD you probably used to install Ubuntu) and mount the filesystem for the installed system. You can do this by running sudo parted -l to view your partitions--there is probably just one ext4 partition, and that's the root filesystem.
Suppose the installed Ubuntu system's root filesystem is on /dev/sda1. Then you could mount it with |
|||||||||||
|
|
Always use |
||||
|
|
|
run recovery mode then type this chown -R root:root /etc/sudoers.d chmod u=rwx,g=rx,o=rx /etc/sudoers.d/ chmod u=r,g=r,o= /etc/sudoers.d/* only the group and user root should have read privelege |
|||
|
|
|
There is nothing wrong #include sudoer.d removing #include sudoer.d won't make any difference. But please make sure you don't have any syntax errors. I had same issue but and spent hours to fix and just figured out they are syntax errors. Refer to manual and make them right. For example Say your username is : dolly I used following which is wrong
correct syntax is
or
hope this helps |
|||||
|
|
I found the bug. It is in the last two lines of the default
|
|||||
|
|
If u messed up your sudoers file.You'll need to:
source :- http://mario.net.au/content/recover-etcsudoers-ubuntu-1204 |
|||
|
|
|
You can edit your boot entry while in grub as well. Simply reboot your pc, and wait for grub to show. Then press "e" on the "Ubuntu" entry to edit it. Look for a line with "linux = " or "kernel = " and simply add an "single" to the end of that line. Then press F10 to boot this temporarily modified boot entry. This will give you a shell (without GUI) with root rights and you can edit the sudoers file with s.th. like nano /etc/sudoers back to its previous state. Then reboot and its done. |
|||
|
|
|
Type in:
Then change last line
To:
It should solve your problem. |
||||
|
|
You can also login as root on a |
||||
|
|
|
check permissions of root system /. it must be owned by root und use 755, than find command of sudo will find the config. |
||||
|
|