can’t open the terminal? illegal value for shell? can’t open /private/etc/sudoers?

One issue I have heard about, involves the /etc/ folder permissions being set to an “bad” value…

For example, if you set /etc/ to 755, Mac OS X will not allow a shell session (terminal) to be opened…  It will report “The Administrator has set your shell to an illegal value“.  If you try an sudo command, you will see an error (“sudo: can’t open /private/etc/sudoers: Permission denied sudo: no valid sudoers sources found, quitting“).

What’s the easiest way to resolve this?

If you are running 10.7, restart your system, and hold down the option key.  This will bring up the boot device list, choose your recovery partition (“Recovery HD“).  The “Mac OS X Utilities” menu will appear, highlight “Disk Utility“ and hit Continue.   From the Disk Utilities left side bar, choose your hard drive (e.g. “Macintosh HD”).  In the “First Aid” pane, click on “Repair Disk Permissions”.

Repair Disk Permissions should repair the permissions issue, and allow you access to the Terminal / Shell sessions.