We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

file permission inheritance from the above folder

addady
addady asked
on
Medium Priority
3,688 Views
Last Modified: 2012-08-13
Hello,

I'm user CentOS 4.3 (RHEL 4 clone) ext3 file system.
What need to be done so that new file will inheritance his directory permition.

For example:

user1 and user2 are in group users

ls -l dira
drwxrwx---  1 user1 users     69 Mar 29 20:02 dira

When user user2 or user root will create a file in dira, I would like that this new file permission will be the same as the home directory dira.

How can I set it?

Thanks,
Addady

Comment
Watch Question

> new file will inheritance his directory permition.
this will not work,
you only can inherit the directories group setting if the directory permission has set the SGID bit (g+s),
for file premissions you have to use the shells umask

BTW, your requirement is impossible to implement: assume a directory permission of 555 then you cannot create a file, same applies to something like 444 for the directory
I come to the same problem, what I did may not be a good way, but at lease it's work

I run a cron job which change the owner of that file(s)/directory(ies) say every 1 hr, so when user(s) under same group the can have the right as I assigned.

for example

59 * * * * chown -R user1:users /data/user1

so every hour all the files inside /data/user1 will own by user1:users.




Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
cron is the quick&dirty way to do it, AFAIK using ACLs might be the proper and clean solution
lol.... as I mentioned may not be a good way but it's work :o)

Author

Commented:
Thank you ahoffmann,

>you only can inherit the directories group setting if the directory permission has set the SGID bit >(g+s), for file premissions you have to use the shells umask

That can be fine.
Following my example above, what setting need to be done in order that all file/dir under "dira" will have group "users" and permition rwx, no matter how create the file/dirs?

>AFAIK using ACLs might be the proper and clean solution

If the first option will not work I will try acl, how difficult is to implement it?

Thaks,
Addady

> .."dira" will have group "users" ..
chmod g+s dira

> .. that all file/dir  .. permition rwx, no matter how create the file/dirs?
as I said you need to set proper umask for each user no matter which one you mean

> ..  try acl, how difficult is to implement it?
security is a process not a product
hence you have to get used to ACLs first, then define your requirements and then configure your ACLs
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.