Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-08-2006, 11:12 PM
|
#1
|
Member
Registered: Nov 2005
Distribution: redhat, debian, ubuntu
Posts: 47
Rep:
|
permissions not inheriting to subdirectories/files
Hello,
How would I go about having the group permissions propagate down to the sub directories/files automatically?
Let's say you create a directory named "finance" and group named "accounting" and do:
chown root:accounting finance
chmod 770 finance
and when a user named bob creates a file inside of "finance" directory, the owner and group get set to bob:bob for that file and not bob:accounting. Is there a way to have the group permissons auto-inherit so that don't need to manually change the permissions every time for other users in the group when they need to edit the file?
Thanks.
|
|
|
12-09-2006, 12:57 AM
|
#2
|
Senior Member
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555
Rep:
|
I believe your looking for the umask command
something like umask 755 directory
That would set new files created inside the directory to
User = 7 or read, write, execute
Group = 5 or Read, Exec
Everyone = 5 Read, Exec
You may want to chown that directory as chown finance:finance
|
|
|
12-10-2006, 07:07 PM
|
#3
|
Member
Registered: Nov 2005
Distribution: redhat, debian, ubuntu
Posts: 47
Original Poster
Rep:
|
Sorry, I meant the group ownership not being inherited.
It seems need to do chown manually every time when a user creates a file/directory b/c it doesn't auto-inherit from the parent directory.
Is there a way for any new directories/files created under finance directory to inherit the group ownership from the parent directory?
|
|
|
12-11-2006, 01:17 AM
|
#4
|
Senior Member
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
|
It's been a while since I played with Linux permissions, but off the top of my head...
umask is the bitmask on the permissions, so if the default is 777 then umask 022 would make the file 755. You don't want to set the umask to 755 or you would get a file with permissions of 022.
In order for directory contents to inherit group ownership, I think they have to be 2775, or was it 1775? I can't remember. Try 1775 first, if that doesn't work go with 2775. The first bit is for setuid/setgid/sticky. 4 is setuid, 2 is setgid, and 1 is "sticky".
|
|
|
12-11-2006, 01:21 AM
|
#5
|
Member
Registered: Mar 2006
Distribution: Slackware64-15.0
Posts: 103
Rep: 
|
Check out the man pages for the chmod command. In there you'll read about the "set user ID" and "set group ID" permissions that you can set for the directory. When these are set for a directory, all newly created files in that directory will have the same group and owner attributes.
So for the directory in question you would set the permission, using the chmod command, to "6xxx" where where xxx is for the User Group and Other permissions.
|
|
|
All times are GMT -5. The time now is 12:21 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|