04.23.08
Breaking teh sudoers file on OS X
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:
Steps:
- 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…
LEEBERT MORRISON said,
September 19, 2008 at 1221869301
THANKS FOR INFO BUT I DONT KNOW HOW
Fix the permissions on /etc/sudoers back to 0440
simpsora said,
September 22, 2008 at 1222115794
The following command will set the correct permissions on the sudoers file:
chmod 0440 /etc/sudoers