Any way to force files to inherit owner permissions from parent directory?
Solution 1:
Linux has something known as Access Control List (ACL). This is a way to extend standard unix permissions and fine tune them. One of the advantages is that it does have inheritance. What could be done, has been referenced by a related post on serverfault, and in your particular case:
sudo setfacl -Rdm g:somegroup:rwx /path/to/parent
As for forcing the files to be owned by the same user, it has been discussed in Getting new files to inherit group permissions on Linux, however forcing the same owner on each file is far more troublesome than having the file to be forced to have same group ownership as done via setfacl
. If the group has exactly the same permissions as the owner, there's no point to force the same ownership. Of course, you could always use inotifywait
and trigger chown
upon file creation, but that's pointless since group ownership already gives you control over the file.
See also:
- Getting new files to inherit group permissions on Linux