0

I "accidentally" ran

sudo chmod -R 0755 /usr/lib

And now many things in my system don't work. Is there a cure for this (Manjaro 17.1) that doesn't involve re-installing my entire system?

ash
  • 209
  • 1
  • 6
  • Boot from a pen and chmod file by file with the help of Google. It is guaranteed to be a good pastime; trial and error might keep you entertained until Spring. – Rui F Ribeiro Jan 03 '18 at 21:03
  • Why is this downvoted? – ash Jan 03 '18 at 21:19
  • I didn’t downvote, but maybe somebody did for lack of research. See [this](https://unix.stackexchange.com/q/194644/80216 "Broken system after chmod -R 644 /"), [this](https://unix.stackexchange.com/q/56610/80216 "Accidentally set /lib permissions to 644"), [this](https://unix.stackexchange.com/q/18591/80216 "Did a “sudo go-wrx” on / … oops, broken"), [this](//unix.stackexchange.com/q/71316/80216 "Ubuntu: sudo find / -type d -exec chmod -Rf a-wr {} \; the user can’t login"), and [this](//unix.stackexchange.com/q/334596/80216 "Is there a way to fix a chmod 777 on an Ubuntu server?"). – G-Man Says 'Reinstate Monica' Jan 03 '18 at 22:56

1 Answers1

2

For a complete and proper fix, you're probably looking at restoring from a backup (you do have a backup, right?) or reinstall. Just doing an ad-hoc find /usr/lib -type f -exec ls -l "{}" \; | grep '^-..x..x..x' on one of my boxen shows a vast scattering of non-directories which should be executable on your host. But not everything is meant to be executable.

DopeGhoti
  • 73,792
  • 8
  • 97
  • 133
  • Egad, [don’t parse the output of `ls`](https://mywiki.wooledge.org/ParsingLs)!  Do `find /usr/lib -type f -perm -111` (or, perhaps more usefully, `-perm /111`).  Or, if you have GNU `find`, you can use `-executable`, but that’s of dubious usefulness.  If checks whether the file is executable *by you*, so, if you aren’t root, it will miss files with modes like 744. – G-Man Says 'Reinstate Monica' Jan 03 '18 at 22:30
  • Not to mention not everything should be 0644 or 0755 either. E.g., `4755` for `/usr/lib/openssh/ssh-keysign` on my Debian box. I would guess loss of set-id bits is what broke the system. – derobert Jan 03 '18 at 22:32
  • BTW: An alternative you might suggest is to install a *different* machine (or VM) with a fresh install with the same packages. Then copy the permissions over. – derobert Jan 03 '18 at 22:35