1

First, I ran:

sudo chmod -R -777 /usr 

Now, my /usr dir permissions looks like this:

d---------

So nobody has permissions I can't even get in the dir or run bash commands.

mchid
  • 43,546
  • 8
  • 97
  • 150

1 Answers1

1

This shows all the different file permissions in /usr, that you'd have to change back:

walt@bat:~(0)$ sudo find /usr -xdev -print0 | xargs -0 -r -n 1000 sudo stat --format="%A" | sort | uniq -c | sort -rn
 440550 -rw-r--r--
  86783 lrwxrwxrwx
  51877 drwxr-xr-x
  16293 -r--r--r--
   8060 -rwxr-xr-x
   1174 drwxrwxr-x
    461 -rw-rw-r--
    363 -r-xr-xr-x
     28 -rwxrwxr-x
     22 drwxrwsr-x
     17 -rwxr-sr-x
     16 -rwsr-xr-x
      6 -rwxr--r--
      4 -rwsr-sr-x
      2 -r-xr-sr-x
      2 -r-xr--r--
      2 -rwsr-xr--
      1 -rwxr-xr--
      1 -rwx------
      1 drwxrwsr-t

This shows all the permissions AND ownerships in /usr that you would have to change back:

walt@bat:~(0)$ sudo find /usr -xdev -print0 | xargs -0 -r -n 1000 sudo stat --format="%A %U:%G" | sort | uniq -c | sort -rn
[sudo] password for walt: 
 440517 -rw-r--r-- root:root
  86783 lrwxrwxrwx root:root
  51870 drwxr-xr-x root:root
  16293 -r--r--r-- root:root
   8058 -rwxr-xr-x root:root
   1174 drwxrwxr-x root:root
    461 -rw-rw-r-- root:root
    363 -r-xr-xr-x root:root
     33 -rw-r--r-- walt:walt
     28 -rwxrwxr-x root:root
     22 drwxrwsr-x root:staff
     16 -rwsr-xr-x root:root
      6 -rwxr-sr-x root:mail
      6 -rwxr--r-- root:root
      6 drwxr-xr-x walt:walt
      3 -rwxr-sr-x root:tty
      2 -r-xr-sr-x root:postdrop
      2 -r-xr--r-- root:root
      2 -rwxr-xr-x walt:walt
      2 -rwxr-sr-x root:utmp
      2 -rwxr-sr-x root:shadow
      2 -rwsr-sr-x root:root
      1 -rwxr-xr-- root:wireshark
      1 -rwxr-sr-x root:ssh
      1 -rwxr-sr-x root:mlocate
      1 -rwxr-sr-x root:games
      1 -rwxr-sr-x root:crontab
      1 -rwx------ root:root
      1 -rwsr-xr-- root:messagebus
      1 -rwsr-xr-- root:dip
      1 -rwsr-sr-x root:mail
      1 -rwsr-sr-x daemon:daemon
      1 drwxr-xr-x walt:root
      1 drwxrwsr-t root:lpadmin

You have stirred your system with a root stick. It's broken. Reinstall, and don't do that.

waltinator
  • 36,399
  • The following answer (in the comments) explains how to install without formatting so that you can maybe keep your home directory. However, you should always make a backup just in case, of course. https://askubuntu.com/a/270045/167115 – mchid Nov 03 '19 at 18:26