File Permissions
Hello,
I've been trying to figure out the best way for configuring file permissions on Red Hat 5.3 and above but I'm having no luck.
What I want to do is create a directory which will have hundereds and hundreds of files and sub-directories.
On the top level I want to set the UID, GID and permissions and have it go through and change every sub-directory and file. Obviously the -R option will do this for me.
But what I need to happen is whenever a new file or sub-durectory gets created by a user I want it to inherit the permissions/ownership from the upper levels.
Our .cshrc/.bashrc are configured for a umask of 2 so we cannot use Sticky Bits in this situation.
I've looked at ACLs and it doesn't seemt o ahve an option for inheriting permissions/ownerships.
Does anyone have any suggestions?
Thanks,
Matt
Responses
Hi Mathew,
You should be able to use the default acl on the parent directory like this. Here testdir is your parent directory and test is user.
setfacl -m d:test:rwx testidr/
setfacl -m d g:test:rwx testidr/
now when you run create a new file and run getfacl on that file , you should be able to see the acl set by default on those files.
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/s1-acls-setting-default.html
Regards,
Antony
Hello Matt,
Could something like this fit in here:
[root@vm ~]# mkdir /testdir
[root@vm ~]# chown root.group1 /testdir/
[root@vm ~]# chmod g+s /testdir/
[root@vm ~]# ll -d /testdir/
drwxrwsr-x+ 2 root group1 4096 Feb 6 15:02 /testdir/
[root@vm ~]# setfacl -m g:group1:rwx /testdir/
[root@vm ~]# su - user1
[user1@vm ~]$ touch /testdir/test.out
[user1@vm ~]$ ll /testdir/test.out
-rw-rw-r--+ 1 user1 group1 0 Feb 6 15:01 /testdir/test.out
[user1@vm ~]$ logout
[root@vm ~]# su - user2
[user2@vm ~]$ touch test1.out
[user2@vm ~]$ touch /testdir/test2.out
[user2@vm ~]$ echouser2
[user2@vm ~]$ echo user2 > /testdir/test.out
[user2@vm ~]$ ll /testdir/
total 12
-rw-rw-r--+ 1 user2 group1 0 Feb 6 15:02 test2.out
-rw-rw-r--+ 1 user1 group1 6 Feb 6 15:02 test.out
It might not be exactly what you want i.e. inhareting permissions from parent directory but with this configurations users should be able to inherit the group ownerships and should be able to modify the files created by other users.
Thanks.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
