How to restore correct permissions to /usr directory?

I did something stupid. VirtualBox was complaining that /usr is not owned by root. So I just did

sudo chown -R root:root /usr

and now i can no loger run

sudo

or

 su - 

or start yast my VMPlayer and VirtualBox don’t run.

If I run

sudo

it says that

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

and

su -

says

su: Authentication failure

So, what are correct permissions of /usr and how to I restore them?

Runing Opensuse 13.2 64bit with KDE. Thank you.

Yeah, that’s definitly a bad idea…

So, what are correct permissions of /usr and how to I restore them?

Run “chkstat --system” to restore all permissions.
If you get error messages, post them please for further advise.

As you can neither use su nor sudo now, you have to login as root though, preferably in text mode.

Thanks for reply. Here i the output:

chkstat --systemChecking permissions and ownerships - using the permissions files
        /etc/permissions
        /etc/permissions.easy
        /etc/permissions.d/postfix
        /etc/permissions.local
setting /etc/ to root:root 0755. (wrong owner/group RavenBlack:users)
setting /usr/lib/utempter/utempter to root:utmp 2755. (wrong owner/group root:root permissions 0755)
/usr/lib/utempter/utempter: chmod: Operation not permitted
setting /usr/bin/at to root:trusted 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/at: chmod: Operation not permitted
setting /usr/bin/crontab to root:trusted 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/crontab: chmod: Operation not permitted
setting /usr/bin/gpasswd to root:shadow 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/gpasswd: chmod: Operation not permitted
setting /usr/bin/newgrp to root:root 4755. (wrong permissions 0755)
/usr/bin/newgrp: chmod: Operation not permitted
setting /usr/bin/passwd to root:shadow 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/passwd: chmod: Operation not permitted
setting /usr/bin/chfn to root:shadow 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/chfn: chmod: Operation not permitted
setting /usr/bin/chage to root:shadow 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/chage: chmod: Operation not permitted
setting /usr/bin/chsh to root:shadow 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/chsh: chmod: Operation not permitted
setting /usr/bin/expiry to root:shadow 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/expiry: chmod: Operation not permitted
setting /usr/bin/sudo to root:root 4755. (wrong permissions 0755)
/usr/bin/sudo: chmod: Operation not permitted
setting /usr/bin/fusermount to root:trusted 4755. (wrong owner/group root:root permissions 0755)
/usr/bin/fusermount: chmod: Operation not permitted
setting /usr/bin/wall to root:tty 2755. (wrong owner/group root:root permissions 0755)
/usr/bin/wall: chmod: Operation not permitted
setting /usr/bin/write to root:tty 2755. (wrong owner/group root:root permissions 0755)
/usr/bin/write: chmod: Operation not permitted
setting /usr/bin/ping to root:root 0755 "= cap_net_raw+ep". (wrong missing capabilities)
/usr/bin/ping: cap_set_file: Operation not permitted
setting /usr/bin/ping6 to root:root 0755 "= cap_net_raw+ep". (wrong missing capabilities)
/usr/bin/ping6: cap_set_file: Operation not permitted
setting /usr/sbin/pppoe-wrapper to root:dialout 4750. (wrong owner/group root:root permissions 0750)
/usr/sbin/pppoe-wrapper: Permission denied                                                                                                                                    
setting /usr/lib64/kde4/libexec/kcheckpass to root:shadow 4755. (wrong owner/group root:root permissions 0755)                                                                
/usr/lib64/kde4/libexec/kcheckpass: chmod: Operation not permitted                                                                                                            
setting /usr/lib64/kde4/libexec/kdesud to root:nogroup 2755. (wrong owner/group root:root permissions 0755)                                                                   
/usr/lib64/kde4/libexec/kdesud: chmod: Operation not permitted                                                                                                                
setting /usr/lib64/kde4/libexec/start_kdeinit to root:root 4755. (wrong permissions 0755)                                                                                     
/usr/lib64/kde4/libexec/start_kdeinit: chmod: Operation not permitted                                                                                                         
setting /usr/lib/polkit-1/polkit-agent-helper-1 to root:root 4755. (wrong permissions 0755)                                                                                   
/usr/lib/polkit-1/polkit-agent-helper-1: chmod: Operation not permitted                                                                                                       
setting /usr/bin/pkexec to root:root 4755. (wrong permissions 0755)                                                                                                           
/usr/bin/pkexec: chmod: Operation not permitted                                                                                                                               
setting /usr/lib/virtualbox/VirtualBox to root:vboxusers 4750. (wrong owner/group root:root permissions 0511)                                                                 
/usr/lib/virtualbox/VirtualBox: Permission denied                                                                                                                             
setting /usr/lib/virtualbox/VBoxHeadless to root:vboxusers 4750. (wrong owner/group root:root permissions 0511)                                                               
/usr/lib/virtualbox/VBoxHeadless: Permission denied                                                                                                                           
setting /usr/lib/virtualbox/VBoxSDL to root:vboxusers 4750. (wrong owner/group root:root permissions 0755)                                                                    
/usr/lib/virtualbox/VBoxSDL: chmod: Operation not permitted
setting /usr/lib/virtualbox/VBoxNetAdpCtl to root:vboxusers 4750. (wrong owner/group root:root permissions 0511)
/usr/lib/virtualbox/VBoxNetAdpCtl: Permission denied
setting /usr/lib/virtualbox/VBoxNetDHCP to root:vboxusers 4750. (wrong owner/group root:root permissions 0511)
/usr/lib/virtualbox/VBoxNetDHCP: Permission denied
setting /usr/sbin/lockdev to root:lock 2755. (wrong owner/group root:root permissions 0755)
/usr/sbin/lockdev: chmod: Operation not permitted
setting /usr/bin/su to root:root 4755. (wrong permissions 0755)
/usr/bin/su: chmod: Operation not permitted
setting /usr/bin/mount to root:root 4755. (wrong permissions 0755)
/usr/bin/mount: chmod: Operation not permitted
setting /usr/bin/umount to root:root 4755. (wrong permissions 0755)
/usr/bin/umount: chmod: Operation not permitted
setting /usr/sbin/postqueue to root:maildrop 2755. (wrong owner/group root:root permissions 0755)
/usr/sbin/postqueue: chmod: Operation not permitted
setting /usr/sbin/postdrop to root:maildrop 2755. (wrong owner/group root:root permissions 0755)
/usr/sbin/postdrop: chmod: Operation not permitted
ERROR: not all operations were successful.

Did you login as root as I told you?
The permissions can only be changed by root obviously, unless the files/folders are owned by your user in the first place (like /etc/ was apparently).

I’ve missed that bit. I’ve run it as root now and it seems to have fixed my permissions.

chkstat is a very usefeull tool. I’ve never heard of it before today. Thank you.

P.S. I’ve also just found out that OpenSuSE forums filters “bad language” :wink:

Makes sense to run “rpm -a --setugids --setperms” before.