Mac OS X Snow Leopard: permissions changed on /var results in dns lookup issues

domain-name-systememailmac-osxpermissionsvar

I was attempting to solve an issue ("/var/log/msmtp.log: permissions denied" error when attempting to send mail using msmtp) when I did this:

> chmod -R 770 /var

After that, my machine would not resolve domain names via cURL. (ping also fails) But, oddly, I can enter domain names into Safari and visit any web pages w/o a problem…

I'm actually not sure if the chmod command is the cause of the problem, but I suspect it is.

Also, if I ls -l on /var (or /private/var) it doesn't seem that any of the subdirectories or files there actually changed permission, but there are many, so I can't say that conclusively…

Incidentally, I fixed the original error (msmtp.log permission denied) by setting TMPDIR=/tmp in my local environment (bash). Now the error goes away, but I get this error:

msmtp: cannot locate host domainname.org: nodename nor servname provided, or not known

Any ideas about how to go about getting DNS working again?

Best Answer

Running chmod -R 700 /var will have made a bunch of important parts of the OS inaccessible to anything but root. You may be able to resurrect things with permissions repair: boot from the Install DVD, select a primary language, then select Disk Utility from the Utilities menu; in Disk Utility, select your HD from the sidebar, then the First Aid tab on the right, then Repair Disk Permissions under that. This may not fix everything back to the way it should be (it doesn't know what the perms should be on all files), but it'll probably get it back to the point where you can boot it.

If it reboots successfully after that, I'd actually run permissions repair again from the booted OS (it'll be using the version of Disk Utility that matches the running OS, and may have a slightly better idea of what the perms should be).