Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
It's also possible that the filesystem was mounted with the nosuid option, in which case mount -u / should fix it (assuming you can get root privileges to do so!). –  200_success Nov 19 '12 at 4:54

3 Answers 3

up vote 9 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.

share|improve this answer

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

share|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

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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