simple local file sharing

From Fluids Wiki
Jump to navigation Jump to search

Here are some simple ways to share files on hood.math (or any Unix system) without emailing them or sending through a sharing service like DropBox or GoogleDocs.

Copy to /tmp

The /tmp directory is writable by all users. Copy your file there and then give it read permission for others:

 % cp afile /tmp/
 % chmod o+r /tmp/afile

Now anybody else can make a copy of it:

 % cp /tmp/afile mydirectory/.

Expose the original

You can make your original file accessible and readable by everyone right where it is, without copying it to /tmp. Let's say your userid is jdoe and the file called afile is in a subdirectory of your account called dir1.

First make the file readable by everyone:

 % chmod o+r dir1/afile

Then enable everyone to traverse your directory to get to the file by adding execute permission for others on the directory:

 % chmod o+x dir1

This does not allow everyone to see the entire contents of your directory; it merely lets them 'cd' through the directory to get to the file. They will not have permission to "ls /u/jdoe/dir1" but they will have permission to copy /u/jdoe/dir1/afile.

Use group permissions on a directory in your account

To restrict sharing to groups, rather than everyone, Unix groups are needed. Ask MFCF to create a group with the required members. Let's say the group name is team-a. Anyone in the group can create a directory in his or her account for sharing, associate the directory with the group, and set group permissions to allow group members access to the directory's contents:

 % mkdir team_a_project
 % chgrp team-a team_a_project  # set the group of the directory
 % chmod g+s team_a_project     # make new files automatically have group perms
 % chmod g+rx team_a_project    # this allows group reading
 % chmod g+rwx team_a_project   # this allows writing too, if you prefer
 % ls -al team_a_project       # check permissions and group membership of
                               # everything to ensure it's the way you want

There is already a group called amfluids that you can use. Run the command

 % grep amfluids /etc/group

to see who the members are. It may or may not match your needs.

Use group permissions on a shared directory outside of any users' accounts

With MFCF's help you can have a directory for sharing that is not in any one user's account. For example, /fsys3/team_a_project could be a directory for all members of the team_a group to share. Permissions would be set up for you the same as in method 3.