Is there a way you can setup a list of receipts of folders and directories of their correct default permissions that can be used as a backup to compare the correct permissions and be used to fix incorrect permissions caused by system or user changes, and installed software?
For example; You install some software package, and installs itself into /usr/lib/
but it modified the permissions for a folder or file, but using a backup list of permissions for those files and folders it can be compared against that and corrected if needed.
file1 is -rwxrwxrwx but should be -rwxr-xr-x
folder1 is drwxrwxrwx but should be drwx------
and so on and so forth… and use the backup list in a script to run a check with the list and the directories and folders and correct them all with chown
, chmod
and setfacl
.
How can this be achieved, and if possible show examples of how it can be done. This might even be useful for a linux server in general if specific permissions need to be kept or set to prevent modifications or changes taking place where it shouldn't, and perhaps have it run automatically after each reboot or system update, and have its list automatically add new ones to the list when needed on the fly without much user interaction required.
is a different problem
when it's not a problem, but a question on how to compare something with a backed up file with the last known permissions. – Dec 22 '15 at 00:41