Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
setting group on new files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
MacFlecknoe
Apprentice
Apprentice


Joined: 11 Feb 2003
Posts: 189
Location: Ann Arbor, MI

PostPosted: Sun Sep 14, 2003 1:06 am    Post subject: setting group on new files Reply with quote

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
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Sun Sep 14, 2003 2:03 am    Post subject: Reply with quote

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
View user's profile Send private message
MacFlecknoe
Apprentice
Apprentice


Joined: 11 Feb 2003
Posts: 189
Location: Ann Arbor, MI

PostPosted: Sun Sep 14, 2003 3:37 am    Post subject: Reply with quote

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 :roll:
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Sun Sep 14, 2003 4:25 am    Post subject: Reply with quote

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
View user's profile Send private message
meowsqueak
Veteran
Veteran


Joined: 26 Aug 2003
Posts: 1549
Location: New Zealand

PostPosted: Thu Sep 18, 2003 1:18 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum