Stanford University School of Earth Science
 
Home
News
New Users
Policies
Network File Server
Web Server
Get Help
Net Connections
Your Macintosh
Your Windows PC
Your Unix/Linux System
Other School Resources
Using Unix

Group write protocol

Last revision October 10, 2005

The system administrator can set up general directories within pangea for group write access, allowing users to collaborate on projects without all the usual swapping of files.

Although the directory has group write/delete permissions, individual files in the directory may have more restrictive permissions. In particular, individual files are normally created with permissions that only allow the owner of the file -- not anyone else in the group -- to update it. Others in the group can delete it or copy another file on top of it, but they cannot simply update the existing file. This is a consequence of Unix file permissions. Having write access to the directory allows you to create new files or to delete entire files; but it does not allow you to modify an existing file unless you also have write access on that specific file.

Another problem with group write access to a directory is the possibility that two different accounts will attempt to update or replace the same file at the same time. This leads to changes that "disappear" or to corrupted files.

To handle both problems listed above -- lack of write permission to modify individual files, and potential for incompatible updates by multiple accounts -- use this protocol for editing files in a group directory:

  1. When you want to edit an existing file, first make a copy of the file in the same directory, using the .new suffix. If you are logging in directly to pangea, you can use a command like:

    cp -i file file.new

    The -i option will notice if there is already a file.new and prompt you to overwrite it. If there is already a file.new, this means that someone else is already working on this file. Do not overwrite his copy. Find out who he is (ls -l will show you the owning account) and coordinate your changes. If there is no existing file.new, then the copy proceeds without incident. The fact that you have created the file.new copy now signals others in the group that you are working on this file (assuming they all follow this same protocol).

    If you are editing files with a Macintosh or PC program, you will have to download a copy to your Macintosh or PC. In order to use this protocol, immediately rename your local copy with the .new suffix and reload that copy up to pangea. Now others can see that you are working on a copy.

  2. Make your changes to the file and test it.
  3. When ready to install your changed version, first rename the old one with a .old suffix, and then rename your new one to the original name. For example, from a pangea login session, you could type commands like these:

    mv file file.old
    mv file.new file

    Because you have write permission to the directory, you will be able to run these mv commands whether or not you have specific write permission on that individual file. Keeping the old version around for a while is good insurance against editing mistakes.

    If you are editing on your Macintosh or PC, first upload the latest version of your .new copy, then rename the old version with the .old suffix and rename your .new copy to the normal name. If you are mounting the /WWW directory as a file share on your Windows PC or MacOS X desktop, you can edit the file names directly. If you are using an scp or sftp file transfer program, use the rename function in that program.

 


Comments?

Stanford University    |