There is a directory I have
/var/new_share/KRA2017/Prateek
with these contents
-rwx------ 1 superadmin superadmin 0 Feb 16 15:14 file1.txt*
-rwx------ 1 superadmin superadmin 0 Feb 16 15:14 file2.txt*
-rwx------ 1 superadmin superadmin 0 Feb 16 15:15 file3.txt*
-rwx------ 1 superadmin superadmin 0 Feb 16 15:15 file4.txt*
in
/var/new_share/KRA2017/
The permission and ownership of directory /var/new_share/KRA2017/Prateek
is
dr-xrwx--- 2 prateekkaien superadmin 4096 Feb 16 15:15 Prateek/
i.e the group owner can only write and user can only read and execute.
Whenever a file is being written by user superadmin
the user and group owner of the files becomes superadmin as shown here. file1.txt file2.txt file3.txt file4.txt
are written by user superadmin
.
I want the user owner of the files to stick to prateekkaien with the same permissions r-x and the group owner to be superadmin with rwx permission like its parent directory.
How is this possible?
Basically all I want is for the files to inherit the owner, group, and permissions of the parent directory.
prateekkaien
(or use an existing one), usesetgid
as described by @dirkt, set the permissions accordingly and leave the user untouched./usr/local
as a setgid ofstaff
, and I'm member ofstaff
, so I can work with files below/usr/local
any way I want. If some other user who is also a member ofstaff
does the same, I don't care, because as a member of the same group, I can modify his files etc.