Ubuntu – Restore permission default of /usr folder

chowndefaultpermissionsusers

I ran a stupid command: sudo chown -R ngoclb:ngoclb /usr.
Then I couldn't use sudo command and login to Ubuntu.
To fix this issue, I using recovery mode to chown /usr to root (sudo chown -R root:root /usr) and can logged in to Ubuntu, but now, the GUI of Ubuntu is not like default (it's same like Windows classic for some component: scrollbar, menu…) and I cannot access to System Settings/User Account.
How can i fix this ?

Best Answer

Almost everything in /usr is owned by root:root

I run find /usr -not -gid 0 -printf "%M\t%u\t%g\t%p\n" here using 15.04 and the output is

-r-xr-sr-x  root    postdrop    /usr/sbin/postqueue
-rwsr-xr--  root    dip /usr/sbin/pppd
-r-xr-sr-x  root    postdrop    /usr/sbin/postdrop
drwxrwsr-t  root    lpadmin /usr/share/ppd/custom
drwxrwsr-x  root    staff   /usr/local/share/xml
drwxrwsr-x  root    staff   /usr/local/share/xml/declaration
drwxrwsr-x  root    staff   /usr/local/share/xml/entities
drwxrwsr-x  root    staff   /usr/local/share/xml/schema
drwxrwsr-x  root    staff   /usr/local/share/xml/misc
drwxrwsr-x  root    staff   /usr/local/share/emacs
drwxrwsr-x  root    staff   /usr/local/share/emacs/site-lisp
drwxrwsr-x  root    staff   /usr/local/share/sgml
drwxrwsr-x  root    staff   /usr/local/share/sgml/declaration
drwxrwsr-x  root    staff   /usr/local/share/sgml/entities
drwxrwsr-x  root    staff   /usr/local/share/sgml/dtd
drwxrwsr-x  root    staff   /usr/local/share/sgml/stylesheet
drwxrwsr-x  root    staff   /usr/local/share/sgml/misc
drwxrwsr-x  root    staff   /usr/local/share/ca-certificates
drwxrwsr-x  root    staff   /usr/local/share/fonts
drwxrwsr-x  root    staff   /usr/local/lib/python3.4
drwxrwsr-x  root    staff   /usr/local/lib/python3.4/dist-packages
drwxrwsr-x  root    staff   /usr/local/lib/python2.7
drwxrwsr-x  root    staff   /usr/local/lib/python2.7/dist-packages
drwxrwsr-x  root    staff   /usr/local/lib/python2.7/site-packages
drwxr-xr-x  root    utempter    /usr/lib/utempter
-rwxr-sr-x  root    utmp    /usr/lib/utempter/utempter
-rwxr-sr-x  root    mail    /usr/lib/evolution/camel-lock-helper-1.2
-rwsr-xr--  root    messagebus  /usr/lib/dbus-1.0/dbus-daemon-launch-helper
-rwxr-sr-x  root    utmp    /usr/lib/libvte-2.91-0/gnome-pty-helper
-rwxr-sr-x  root    crontab /usr/bin/crontab
-rwxr-sr-x  root    tty /usr/bin/wall
-rwxr-sr-x  root    tty /usr/bin/bsd-write
-rwxr-sr-x  root    shadow  /usr/bin/chage
-rwxr-sr-x  root    shadow  /usr/bin/expiry
-rwxr-sr-x  root    mail    /usr/bin/mail-unlock
-rwxr-sr-x  root    mlocate /usr/bin/mlocate
-rwxr-sr-x  root    mail    /usr/bin/dotlockfile
-rwxr-sr-x  root    mail    /usr/bin/mail-touchlock
-rwxr-sr-x  root    mail    /usr/bin/mail-lock
-rwxr-sr-x  root    ssh /usr/bin/ssh-agent
-rwsr-sr-x  daemon  daemon  /usr/bin/at

and given the output, I don't see what you might have wrong to get what you describe. May be the dbus stuff...

But you can nonetheless manually chown the above file to try to get your ubuntu back.

you might not have the same files or I may miss some of your files, so even if you manually chown the files above, you're not entirely finished with it.

Related Question