View previous topic :: View next topic |
Author |
Message |
MacFlecknoe Apprentice
Joined: 11 Feb 2003 Posts: 189 Location: Ann Arbor, MI
|
Posted: Sun Sep 14, 2003 1:06 am Post subject: setting group on new files |
|
|
is there a way to set a sticky bit on files created in a certain directory to have them owned by a particular group?
I have setup a cvs repository for users to check in their projects but i want the developers to be able to freely borrow one anothers code. I have set the permissions on the cvs directory to 665 and have it belonging to a 'cvs' group. I have also added all the developers to the same 'cvs' group. Now how do i force any file being written to the directory to default to the group 'cvs'? As it stands the files are all owned by the default group of the user writing the file.
The users belong to several groups so setting ther default group to cvs isnt an option.
Thanks in advance! |
|
Back to top |
|
|
BitJam Advocate
Joined: 12 Aug 2003 Posts: 2508 Location: Silver City, NM
|
Posted: Sun Sep 14, 2003 2:03 am Post subject: |
|
|
Just do: Code: | # mkdir top_directory
# chgrp cvs top_directory
# chmod g+s top_directory |
Setting the group sticky bit on a directory causes the group to be inherited by all files and directories created in that directory. |
|
Back to top |
|
|
MacFlecknoe Apprentice
Joined: 11 Feb 2003 Posts: 189 Location: Ann Arbor, MI
|
Posted: Sun Sep 14, 2003 3:37 am Post subject: |
|
|
thanks alot... i guess i should have rtfm; i had half guessed it when i mentioned the sticky bit =)
edit... looks as though i only THOUGHT i mentioned the sticky bit. But i WAS thinking of it;... honest |
|
Back to top |
|
|
BitJam Advocate
Joined: 12 Aug 2003 Posts: 2508 Location: Silver City, NM
|
Posted: Sun Sep 14, 2003 4:25 am Post subject: |
|
|
You did mention the sticky bit. I think this was a good question because I don't know which FM contains this information.
I didn't mean to imply rtfm. I didn't know your skill level so I gave command line instructions and a brief explanation. |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Thu Sep 18, 2003 1:18 am Post subject: |
|
|
That's not the sticky bit - it's the set group ID on execution bit. The sticky bit looks like this:
Code: | $ chmod +t directory
$ ls -l
drwxr-x--T directory |
From the chmod man page:
Quote: |
STICKY FILES
On older Unix systems, the sticky bit caused executable files to be hoarded in swap
space. This feature is not useful on modern VM systems, and the Linux kernel
ignores the sticky bit on files. Other kernels may use the sticky bit on files for
system-defined purposes. On some systems, only the superuser can set the sticky
bit on files.
STICKY DIRECTORIES
When the sticky bit is set on a directory, files in that directory may be unlinked
or renamed only by root or their owner. Without the sticky bit, anyone able to
write to the directory can delete or rename files. The sticky bit is commonly
found on directories, such as /tmp, that are world-writable.
|
|
|
Back to top |
|
|
|