How to restore permissions in /usr/lib folder?
Solution 1:
I followed these steps, from How to Easily Back Up and Restore Linux File Permissions, to get a backup of permissions using another ubuntu system (by booting from a Ubuntu USB image) and then restored it. It works.
To backup permissions:
getfacl -R TEST > test_permissions.txt
To restore permissions:
setfacl --restore=test_permissions.txt
Solution 2:
This is not recommended, but probably what I would have done:
$ dpkg -S '/usr/lib/*' | \
cut -d : -f1 | sed 's/, /\n/g' | sort -u >> dpkg-package.log
This creates a package list of all packages that have files in /usr/lib
, the next step is to sort out locally installed or non-installable packages.
$ xargs -a ./dpkg-package.log apt-get --dry-run reinstall
If apt-get complains about packages, move them from the dpkg-package.log to dpkg-temp.log. When you are ready to reinstall, just remove the --dry-run option. This will restore the permission on the reinstalled files.