Using this helpful post I am able to set a default group and file permissions in a folder.
I'm having trouble setting a default owner (teamlead uid 1234).
setfacl -d -m g::rwx /my/test/folder
setfacl -d -m o::rx /my/test/folder
getfacl /my/test/folder
# file: /my/test/folder
# owner: teamlead
# group: web_prod
# flags: -s-
user::rwx
group::r-x
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
With that:
[mary@boxen]# touch /my/test/folder/somefile
[mary@boxen]# ll /my/test/folder/somefile
-rw-rw-r--. 1 mary web_prod 0 Nov 6 08:58 somefile
So the right group is assigned, but the new file has ownership of the user creating the file. I'd like newly created files to have teamlead:web_prod owner/group.
It appears that setfacl
can be used to set a default user, too. With the existing folder acl config (above):
[mary@boxen]# setfacl -d -m u:1234:rwx /my/test/folder
Now to create a file as a different user. I'm expecting it to have teamlead:web_prod ownership.
[mary@boxen]# touch /my/test/folder/anotherfile
[mary@boxen]# ll /my/test/folder/anotherfile
-rw-rw-r--+ 1 mary web_prod 0 Nov 6 08:58 somefile
New file still has ownership of the owner creating the file, not uid 1234(teamlead).
Is what I'm after even possible, or is the way I'm going about this wrong?
With setfacl you can set default permissions but not default owner/group for newly created files.
. Instead I want set default owner/group for newly created files. – Mario Palumbo Jul 22 '22 at 09:32