-
Notifications
You must be signed in to change notification settings - Fork 2
Description
As Froster is primarily an end user tool that does not run as root user, it will require at least read permissions for all file system indexing processes and read+write permissions to complete archiving processes. Posix file systems tend to experience permission drift over time. To ensure seamless collaboration among users, a systems administrator will have to repair permissions occasionally. As this process can be labor and time consuming, Froster can prepare the commands that a systems administrator will then review and execute as root. We need to address 3 use cases:
- The group ownership of a file or folder is incorrect, often because of issue 2 (setgid) or because users made an incorrect permission change
- The setgid bit, which ensures that that new folders and files inherit the group ownership from a parent directory, has been removed / overwritten and new files are no longer created with the correct permissions. Instead they have the group permission of the primary group of the user who created the files. This primary group may very well be a different department and other project members are not members of this group which leads to file access problems.
- Files and Folders have no read and/or write permissions for the owning group. This often occurs because of software errors or because software thinks it requires specific permissions.
For all 3 problems there is a solution that can be executed as root, for example:
- For example, change all files and folders owned by group
applestooranges:find /my/dir -group apples -exec chgrp oranges {} + - set the setgid bit for all directories that don't have it:
find /my/dir -type d ! -perm -2000 -exec chmod g+s {} + - ensure that all files and folders owned by group oranges have rw permissions:
find /my/dir -group oranges ! -perm -g+r -exec chmod g+r {} + -o ! -perm -g+w -exec chmod g+w {} +
As crawling through the file system can take a very long time we can use pwalk and duckdb to generate text files containing file and folder lists for which permissions need to be adjusted. Permission changes can then be executed in parallel via xargs, for example here with 256 parallel processes triggered by xargs:
-
make sure to use the gid (e.g. 3901) and not the group name to avoid creating a fork bomb:
xargs -a repair-grp-hpcusers.txt -P 256 -d '\n' chgrp 3901 -
xargs -a repair-setgid.txt -P 256 -d '\n' chmod g+s -
xargs -a repair-read-write-lab.txt -P 256 -d '\n' chmod g+rw
Froster could generate the text files required to repair permissions, or repair the permissions directly, for example:
froster index --repair-permissions --chgrp oldgroup:newgroup,oldgroup2:newgroup2
There are 3 different usage patterns:
- End user runs
froster index --repair-permissionsand hands over text files to system Administrator who will run the permission repair (this is the most inaccurate option as the end user may not have read access to a significant number of folders) - System administrator runs
froster index --repair-permissionsand will repair permissions directly. - user runs
froster index --repair-permissions --pwalk-csv myfile.csv /my/folderwith a pwalk csv file previously run by a Systems administrator (this is an option if the Systems Administrator does not use Froster but prefers text files that contain files and folders that require certain actions)