I ran

$ sudo chown -R $USER /usr/bin 

and now when I try to run programs under the /usr/bin path as sudo I get

sudo:must be setuid root

What should I do if I would like to revert the chown?

link|improve this question
feedback

3 Answers

up vote 1 down vote accepted

Run Disk Utility, select your boot volume, and use "Repair Permissions". Since the files in /usr/bin (including sudo) were installed as part of the OS, it knows what their ownership and permissions should be, and it'll set them back properly.

link|improve this answer
feedback

You need to chown the files back to root and then chmod u+x all the programs that should be setuid root.

link|improve this answer
$ sudo chown -R root /usr/bin ==> sudo: must be setuid root – jerome Sep 29 '11 at 2:33
Login as root in the first place. Don't try to use sudo. If you don't allow root logins at all (not even by ssh), you may have to boot to a recovery shell to fix it. – David Schwartz Sep 29 '11 at 2:35
I am the root user. If I run chwon -R root /usr/bin as that user, I get a bunch of Operation is not permitted messages for every program and file in /usr/bin. – jerome Sep 29 '11 at 2:42
Are you sure it's every file and program? It should just be the ones set system immutable, which you wouldn't have been able to mess up anyway. If you're 100% sure, you'll have to clear the system immutable flag by issuing a chflags noschg command, likely in single-user mode. – David Schwartz Sep 29 '11 at 2:45
feedback

I'm not familiar with OSX but in Linux, you can do it by running su - to login as root and chown -R root /usr/bin.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.