Not having anything better to do, I horked my sudoers file while modifying an entry, thereby preventing myself from sudoing at all (and subsequently fixing it). Weak.
Turns out there’s a pretty easy fix for this using the Finder, so long as your account has administrator privileges:
- In the Finder, go to /etc (or do <cmd>-<shift>-g and enter /etc, if you don’t see it in the Finder)
- Get Info on sudoers
- In the Info window’s Sharing & Permissions section, add an entry for your local user with read and write access
- With a text editor, edit /etc/sudoers and fix the problem.
- Fix the permissions on /etc/sudoers back to 0440.
- Enjoy your newly-regained sudo power!
Of course, this can be used to overcome other permissions problems too.
If only visudo had a validator, along with a syntax checker…