LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-08-2006, 11:12 PM   #1
pridefc
Member
 
Registered: Nov 2005
Distribution: redhat, debian, ubuntu
Posts: 47

Rep: Reputation: 15
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.
 
Old 12-09-2006, 12:57 AM   #2
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
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
 
Old 12-10-2006, 07:07 PM   #3
pridefc
Member
 
Registered: Nov 2005
Distribution: redhat, debian, ubuntu
Posts: 47

Original Poster
Rep: Reputation: 15
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?
 
Old 12-11-2006, 01:17 AM   #4
chort
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: Reputation: 76
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".
 
Old 12-11-2006, 01:21 AM   #5
regis_n_bits
Member
 
Registered: Mar 2006
Distribution: Slackware64-15.0
Posts: 103

Rep: Reputation: Disabled
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing permissions of folder and subdirectories esc_5p1d0r Linux - Newbie 4 01-13-2007 03:39 PM
Inheriting file permissions Hardip Linux - Security 4 07-03-2006 12:56 AM
inheriting permissions steve007 Linux - Security 3 07-06-2005 12:09 AM
Limited permissions in subdirectories dwz3591 Linux - Newbie 1 04-27-2004 05:58 AM
delete files / keep subdirectories? lhorstman Linux - Newbie 2 01-10-2003 04:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration