Discussion:
How to share files with UNIX usergroup
(too old to reply)
Thom Bohdanowicz
2011-07-26 00:30:48 UTC
Permalink
Hi I'm having quite a hard time figuring out how to share files with my
partner via our UNIX usergroup.

We're group cs246_XX

from what I understood from reading archived usergroup messages, to
share a directory, say ~/proj with my partner, where ~/proj contains all
of my .cpp and .h files, i use the command "chgrp cs246_xx ~/proj", and
then my partner, on his linux.cs account, will now have the directory
~/proj which he can access which contains all of the .cpp and .h files?

Is this right/wrong? we've been unable to successfully share anything

thanks for any help

-Thom
Jeremy Roman
2011-07-26 01:38:02 UTC
Permalink
I forgot to mention that another possible approach is using version
control software for this. The amount of setup work is comparable, but
if you are not used to using one already, there's probably not enough
time left before the deadline to make it worth your while. (It's a good
idea for the future, though.)
--
Jeremy Roman
Student, Computer Science
University of Waterloo
Jeremy Roman
2011-07-26 01:33:31 UTC
Permalink
Post by Thom Bohdanowicz
Hi I'm having quite a hard time figuring out how to share files with my
partner via our UNIX usergroup.
We're group cs246_XX
from what I understood from reading archived usergroup messages, to
share a directory, say ~/proj with my partner, where ~/proj contains all
of my .cpp and .h files, i use the command "chgrp cs246_xx ~/proj", and
then my partner, on his linux.cs account, will now have the directory
~/proj which he can access which contains all of the .cpp and .h files?
Is this right/wrong? we've been unable to successfully share anything
thanks for any help
-Thom
Firstly, you will probably want to do this recursively, so that the
files in the directory have shared permissions as well. I would also
recommend setting the setgid flag on the directory, which will cause all
files created in that directory to inherit the same group.

I haven't done this myself on the student.cs systems, but here's roughly
what I would do (this can be simplified somewhat if you don't have
subdirectories, etc):

# change group on ~/proj and all contained files and directories
chgrp -R cs246_xx ~/proj

# assign appropriate permissions to all contained files and directories
find ~/proj -type d -exec chmod 2770 {} +
find ~/proj -type f -executable -exec chmod 0770 {} +
find ~/proj -type f \( ! -executable \) -exec chmod 0660 {} +

This should set up appropriate permissions on existing files. I would
also then run:

umask 007

before each time working on the project, so that group-writable
permissions will be applied by default on new files.

Since this will exist only in your home directory, for your partner to
access it he or she will have to go to ~tbohdano/proj. If this person
wants to access it as ~/proj, I would recommend that person create a
symbolic link, like this:

ln -s ~tbohdano/proj ~/proj


I realize that this is fairly involved; it's possible someone has done
the legwork to make this easier in some way, but I'm not aware of one. I
may write a script to this effect.
--
Jeremy Roman
Student, Computer Science
University of Waterloo
Thom Bohdanowicz
2011-07-26 01:50:35 UTC
Permalink
Thanks for your reply. turns out what I said before was mostly correct
except I was assuming that shared copy of the folder would show up in
/u7/mypartnersid/, whereas what I'm doing is actually setting the
permission on/u7/myid/directory so that my partner would be able to
access it from the root. my bad. but yeah no script or anything else
painful necessary!
Post by Jeremy Roman
Post by Thom Bohdanowicz
Hi I'm having quite a hard time figuring out how to share files with my
partner via our UNIX usergroup.
We're group cs246_XX
from what I understood from reading archived usergroup messages, to
share a directory, say ~/proj with my partner, where ~/proj contains all
of my .cpp and .h files, i use the command "chgrp cs246_xx ~/proj", and
then my partner, on his linux.cs account, will now have the directory
~/proj which he can access which contains all of the .cpp and .h files?
Is this right/wrong? we've been unable to successfully share anything
thanks for any help
-Thom
Firstly, you will probably want to do this recursively, so that the
files in the directory have shared permissions as well. I would also
recommend setting the setgid flag on the directory, which will cause all
files created in that directory to inherit the same group.
I haven't done this myself on the student.cs systems, but here's roughly
what I would do (this can be simplified somewhat if you don't have
# change group on ~/proj and all contained files and directories
chgrp -R cs246_xx ~/proj
# assign appropriate permissions to all contained files and directories
find ~/proj -type d -exec chmod 2770 {} +
find ~/proj -type f -executable -exec chmod 0770 {} +
find ~/proj -type f \( ! -executable \) -exec chmod 0660 {} +
This should set up appropriate permissions on existing files. I would
umask 007
before each time working on the project, so that group-writable
permissions will be applied by default on new files.
Since this will exist only in your home directory, for your partner to
access it he or she will have to go to ~tbohdano/proj. If this person
wants to access it as ~/proj, I would recommend that person create a
ln -s ~tbohdano/proj ~/proj
I realize that this is fairly involved; it's possible someone has done
the legwork to make this easier in some way, but I'm not aware of one. I
may write a script to this effect.
Loading...