Ubuntu: borked my sudoers file, how can I fix it?
Solution 1:
You should never edit your sudoers file directly. Use visudo
- it will protect you from these syntax errors in the future.
To recover from this situation, either boot into single-user mode and edit the file or boot off of a livecd and do the same.
Solution 2:
Boot the system into single mode and then edit it.
Solution 3:
As noted in this similar question on askubuntu, this may well work without having to reboot into single-user mode:
pkexec visudo
Solution 4:
If you have Docker installed and your user is a member of the docker
group you can easily get yourself out of this pickle (and some others) without rebooting or what-have-you:
$ docker run -it --rm -v '/etc/:/root/host.etc/' debian bash
apt-get update && apt-get install [vim|nano|whatever]
cd ~/host.etc/
- Repair the problem files
exit