Messed up /etc/sudoers

So I messed up my sudoers file which resulted in the absence of any sudo user.

To recover from that error you reboot into recovery mode. On Ubuntu 14.04 hold the Shift key when booting.

Get access to a root console (via Advanced options) and correct the error.

That doesn't work, because the system is mounted read-only.

Searching for a solution I read some interesting stuff.

In previous Ubuntu versions you could do mount -o rw,remount / But from Ubuntu 14.04 on there is no longer a rw option.

The enable-networking option will mount the system rw.

But when I did that, vi said the file was opened "READ-ONLY". So that did not seem to work either.

The solution?

ls -l /etc/sudoers

Yeah, really.

Sources

http://askubuntu.com/questions/120153/how-to-change-read-only-file-at-root-prompt

http://www.psychocats.net/ubuntu/fixsudo

Sunday December 20, 2015