How to fix an invalid /etc/sudoers file if root access is disabled

raspberry piraspbmcrootsudosudoers

This pertains to my Raspberry Pi, on which I have Raspbmc installed. I do realize that there is a Raspberry Pi StackExchange site, but I figured I might get more eyes on this problem here.

The issue is that I modified /etc/sudoers in an attempt to grant NOPASSWD permissions to one of the users, but I guess somewhere along the way I borked up the file and now I'm getting the following error whenever I login/attempt to use sudo:

sudo: parse error in /etc/sudoers near line 19
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

I've found similar posts on Ubuntu as well as StackOverflow, but the problem is all the answers require a root password, and the root account is disabled by default on Raspbmc, and I obviously had not enabled it before attempting to change /etc/sudoers.

So my question is: how do I fix the file if I don't have root access enabled? Is it even possible?

Best Answer

You should still be able to boot up the Pi in Single User mode to get access to root.

Using another computer, modify cmdline.txt and add single to the end of the line
Then when you boot up the Pi from the SD card, it should automatically dump you to a root prompt which well allow you to update /etc/sudoers

Related Question