Recovery from a broken sudo
July 28, 2006 at 3:29 am 1 comment
Ubuntu is probably the first distro that uses sudo instead of a root account. Recently, I started playing with it to help a friend out with a computer problem and discovered that sudo is rather fragile. For example, if you were to accidently delete or damage the /etc/sudoers file, sudo would stop working. You would not be able to get the sudoers back because you can’t sudo!
To recover, reboot your Ubuntu. At the boot manager, you should see an option for recovery, select that version and you’ll boot into root in text mode. From there, you can fix /etc/sudoers and everthing will be back to normal.
What did surprise me is that there is no root password. I thought when I type sudo, it was actually switching to root. Apparently, this is not the case. I am not sure if this would count as a security risk or not.
To avoid damaging your sudoers file, always edit it with sudo visudo. Visudo apparently checks the file for validity before saving it, so you don’t accidently damage your sudoers file.
1.
Alan Yeates | August 2, 2006 at 10:49 pm
Mine got broken through an unresovled repository request, it ain’t hard to do! The console usually still works however, not much help for us noobies!