Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a new directory and keeping all parent's attributes?

Status
Not open for further replies.

mucklow

Programmer
May 22, 2001
40
US
I'm trying to figure out how to set up a parent directory so that all sub-directories/files created afterwards retain the same permissions as the parent, regardless of which user/group created it. I know the SGID attribute in the ACL table retains the group ID, but I need the ownership and all extended permissions to be retained as well. SUID doesn't work, and umask is set to 022 but doesn't work either. Any suggestions?
 
Setting the umask is unlikely to help (as depending on where you set it) it will make the change system wide, or valid for a user no matter where they place the file they create.

Besides the umask value affects directories and files differently - one uses 777 as base the other 666 as a base (deduct the umask from those figures to get the 'octal' permissions).

This is probably a bit extreme (and no doubt there's a simple command to enable you to do what you need to) but you could always alias the mkdir command, and write your own script to check the current directory ($PWD) and if it is the required directory set permissions as required.

I'm sure someone will have a better answer, but it's only just gone 8am :)

Cheers.
Dave V.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top