Macos – How to fix /etc/ folder on Mac OS X

chmodmacmacos

I was following a tutorial which had this command to create a launchd.conf file in /etc/

sudo echo "some command" > /etc/launchd.conf

But it wouldn't work, I got permission denied after entering my admin password.
It seemed like the permissions for the link were wrong, so I did sudo chmod 755 /etc/
But now I can't load a terminal, I get the error The administrator has set your shell to an illegal value

If I tried to sudo a command now I get

sudo: can't open /private/etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
Process *tramp/sudo root@localhost* exited abnormally with code 1

This is what the link /etc looks like, what should it look like, and how do I restore it?

lrwxr-xr-x   1 root           wheel          11 Jul 21  2011 etc -> private/etc

/private/etc …

drw-r--r-- 111 root           wheel    3774 Mar 26 02:25 etc

edit: I'm using Mac OS X 10.7.3

Best Answer

Kyle Jones' answer will definitely work, but have you tried running a Permissions Repair from Disk Utility? That might do the trick....