LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   dir and group ownership automatic set (https://www.linuxquestions.org/questions/linux-newbie-8/dir-and-group-ownership-automatic-set-649039/)

thllgo 06-13-2008 07:35 AM

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.

Dudydoo 06-13-2008 08:21 AM

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.

thllgo 06-13-2008 10:27 AM

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 :scratch:

Dudydoo 06-13-2008 10:36 AM

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.


All times are GMT -5. The time now is 07:41 AM.