Groups

You may decide to work in teams of 2. If you do that, how can you work on the same files, without sharing passwords and actually logging into the same account?

A good way to solve the problem is with UNIX groups. You and your partner (and no one else) can become members of the same UNIX group. Then, directories and files you are working on can be made readable and writable to that group, so that only you and your partner can read and modify them. (The files will reside under the home directory of one of you or your partner... but you don't need to log into each other's accounts or share passwords.) To take advantage of this, do the following.

  1. From one of your accounts, after prepping into the cs120s environment prep cs120a, run the command requestgroup and enter your login names.

  2. ACS will then create a unique group containing just the 2 logins you requested. (Unfortunately this may take a few days.) You can tell when your group has been set up: run the command groups This will show the groups you are in. The new ACS-created group will appear as something like cs120s_#. When you see that, you are ready to proceed.

  3. In one of your accounts, say joeuser, create a directory you want to use as your shared working directory, say Project1: cd and then mkdir Project1. Make sure this directory has its group sticky bit set: ls -ld Project1 You should see something like:

    drwxrws---   2 cs120s      4096 Apr 17 21:29 Project1
    That s at the end of drwxrws--- is the group sticky bit. If you do not see the group sticky bit or the group w bit, you'll need to add it by typing: chmod 2770 Project1 Now then you type: ls -ld Project1 You should see the s at the end of drwxrws---.

  4. Now make that directory's group ID be the new group you and your partner are in by running the chgrp command:chgrp cs120s_# Project1 Do ls -ld again to make sure the group ID has changed:

    ls -ld Project1
    drwxrws---   2 joeuser cs120s_#      4096 Apr 17 21:29 Project1

  5. Now you can copy the contents of the nachos distribution to your shared Project1 directory.

    [Important]:, If you downloaded the nachos distribution from the course website, the default permission bits in distribution was likely incorrect: if you do ls -ld Project1/nachos and see the following result

    drwx--S---   15 joeuser cs120s_#      4096 Mar 23  2011 nachos
    perform the following to fix the permission bits.
    1. cd Project1
      find nachos -type d -exec chmod g+rwx {} \;
      Now when you ls -ld nachos, you should see the fixed bits for nachos folders
      drwxrws---  15 joeuser cs120s_#      4096 Mar 23  2011 nachos
    2. Then you need to fix the bits for executable files, do
      find nachos -type f -executable -exec chmod g+rwx {} \;
      Verify that executables have the correct bits as follows,
      ls -l nachos/bin/nachos 
      -rwxrwx---   1 joeuser cs120s_#      322 Sep  2  2006 nachos/bin/nachos
    3. Lastly, fix the bits for regular files,
      find nachos -type f -exec chmod g+rw {} \;
      Verify the files have correct bits as follows,
      ls -l nachos/Makefile 
      -rw-rw----   1 joeuser cs120s_#      1500 Sep  2  2006 nachos/Makefile

  6. You have to do one more thing: set the world 'x' bit on your home directory (the one containing the Project1 directory): chmod o+x .

  7. Now either of you in the group can cd to that Project1 directory, create, read, and write files and directories, etc. To make it even more convenient, the other member of your group can create a symbolic link to the shared project directory under their own home directory. When logged into the other/partner account, do:

    ln -s full_path_to_joeuser_Project1_directory .
    You'd replace the string full_path_to_joeuser_Project1_directory with the actual Unix path to joeuser's Project1 directory.

Source Control

Now that you're able to share a directory using Unix groups, you may want to use some source control software to facilitate concurrent editing and versioning. Source control (also called version control) can help you and your partner coordinate working together on the same files. You are under no obligation to use source control to work in a group. However it may make things easier.

There are several popular source control management (SCM) software available:

  1. Subversion (SVN)

  2. Git

  3. Mercurial

  4. CVS

If you never heard of them before and don't know which one to choose, subversion (SVN) is a good start to understand the basic concepts of version control.

Many of them are probably installed on the ieng6 server. So feel free to setup a repository in the shared directory to allow both you and your partner to work concurrently.