LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-13-2008, 08:35 AM   #1
thllgo
Member
 
Registered: Sep 2003
Location: Laurel MD
Posts: 294

Rep: Reputation: 32
dir and group ownership automatic set


Hello,

Is it possible to set the ownership and group on a dir in such a way that all files created in that dir will automatically be set to a specific owner and group regardless of who creates the file?

I have a shared project dir that holds documentation for our project and I would like all the documents in the dir to be owned by the project and in the projects group.

I can create a cron job that will run each night and do a chown and chgrp on the dir but was wondering if it was possible to set permissions in such a way that no matter who creates a document there it will be at the permission level of the dir.

I've searched the web and can't find anything like this, so I'm guessing I just keep running the cron job. The closest I've found is setting super bits, but that doesn't seem to work for newly created documents.

thank you for any help you may have.
 
Old 06-13-2008, 09:21 AM   #2
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
This should work for a directory:

Code:
chmod g+s /name/of/directory
chgrp <group> /name/of/directory
All new files created in the directory will now have the same group id.
 
Old 06-13-2008, 11:27 AM   #3
thllgo
Member
 
Registered: Sep 2003
Location: Laurel MD
Posts: 294

Original Poster
Rep: Reputation: 32
thank you.

It seems to work for the group, but not ownership. I even tried a
chmod 6775 on the dir so it looks like drwsrwsr_x.

I must go back and study more on superbits. Bummer
 
Old 06-13-2008, 11:36 AM   #4
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
It doesn't work for user ownership. The setuid bit has no effect.

A google 'I'm feeling lucky' produces this link:

http://www.comptechdoc.org/os/linux/..._ugfilesp.html

Which is helpful.

Last edited by Dudydoo; 06-13-2008 at 11:41 AM.
 
  


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
Set group ownership on files as they are created gatsby Linux - Newbie 1 02-25-2008 04:31 PM
permissions and ownership on dir gabsik Linux - Software 4 02-05-2007 07:48 AM
File ownership - changing a whole dir to different owner sKAApGIF Linux - Desktop 6 08-21-2006 09:25 AM
Could not modify the ownership of a dir RayQ Linux - General 12 12-29-2004 06:37 PM


All times are GMT -5. The time now is 09:29 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration