Repair a broken sudoers file [duplicate]

Solution 1:

Nope, you have to reboot, or log in as root if you allow root logins.

This is the reason you should always use visudo when you modify the sudoers file. visudo will check the syntax of the sudo file before saving it, protecting you from this specific problem (but not from writing a sudoers file that disallows you from running sudo!)

Note that sudoers is normally setup to not be writable even by root on Ubuntu:

-r--r----- 1 root root 556 2010-04-18 15:05 sudoers

So you must have changed the access rights on sudoers to modify it with nano. There is a very good reason files are setup like this. If you come across a file that is not writable by root you should think one, two and three times before you change access rights and start editing it.