You are not logged in.
Hi,
Im trying to setup a shared local folder that is used by several users who are all members of a secondary group.
Problem is that I cant find a reliable way to enforce the file permissions inside said folder for both new and copied files.
In case of new files, all it takes is to set the setgid bid on the folder and force the default permissions using ACLs.
However this does not affect any copied files.
Every time a user copies a preexisting file or folder into the target path, it requires a manual chown and chmod run to fix the permissions.
Is there a way to automatically enforce a specific group and permissions even for copied files?
Thanks
Last edited by Felix001 (2022-11-15 03:10:45)
Offline
You can monitor the folder w/ https://man.archlinux.org/man/community … ywait.1.en and sanitize the file properties on changes.
Alternatively mount a non POSIX capable FS (vfat) into the folder w/ the desired uid/gid/umask
Offline
Long-term, that might not be what you want the end-result "experience" to be for that shared drive. You might want to look into NFS idmap for a more durable long-term solution.
Offline
You can monitor the folder w/ https://man.archlinux.org/man/community … ywait.1.en and sanitize the file properties on changes.
Alternatively mount a non POSIX capable FS (vfat) into the folder w/ the desired uid/gid/umask
Thanks for the reply, this worked pretty well (and the inotify feature is pretty cool)
For anyone looking for a solution, this is what I use for now:
inotifywait -q -m -r -e moved_to,create /mypath/files |
while read -r directory events filename; do
TARGET=$directory$filename
#echo "file: $directory$filename event: $events"
if [[ -f "$TARGET" ]]
then
chmod 660 "$TARGET"
#echo "changed file"
elif [[ -d "$TARGET" ]]
then
chmod 770 "$TARGET"
#echo "changed dir"
fi
done
Offline
If the overhead of a fuse layer is acceptable you can look into bindfs (in the AUR):
https://bindfs.org/docs/bindfs.1.html
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline