[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

file permission inheritance from the above folder

Posted on 2006-03-30
8
Medium Priority
?
3,672 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

0
Comment
Question by:addady
  • 3
  • 2
6 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16333585
> 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
0
 
LVL 12

Accepted Solution

by:
paullamhkg earned 200 total points
ID: 16338572
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.




0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 200 total points
ID: 16339983
cron is the quick&dirty way to do it, AFAIK using ACLs might be the proper and clean solution
0
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

 
LVL 12

Expert Comment

by:paullamhkg
ID: 16340126
lol.... as I mentioned may not be a good way but it's work :o)
0
 

Author Comment

by:addady
ID: 16348372
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

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16350475
> .."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
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
Fine Tune your automatic Updates for Ubuntu / Debian
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month17 days, 23 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question