# Steps to Accessing CVS on scidac.ca.sandia.gov

Updated March 28, 2002

The following instructions will allow you to access CVS repositories on
scidac.ca.sandia.gov from your local machine using SSH port forwarding
to establish an encrypted connection.

CVS on scidac is currently running in "pserver" mode. Thus to access the
repository on this machine, you need to have a CVS username and
password. This is [not]{.underline} the same as a standard Unix login ID
and password. Before gaining access to the CVS repositories on
scidac.ca.sandia.gov, you must gain access to scidac itself. To do so,
send e-mail to [*mplee@sandia.gov*](mailto:mplee@sandia.gov) requesting
a user account on scidac. Within one working-business day, I will
respond with a user account and an initial password. You should change
this password as soon as possible. Keep in mind that this account will
be using the "Restricted Shell," so many of the functions you're used to
will be disabled. We do this only because the purpose of this UNIX
account is just to create the necessary SSH-tunnel that you'll need when
accessing your CVS account (we'll cover this shortly). For more
information on the Restricted Shell, please feel free to run 'man
restricted_shell' once you've logged in.

Once your UNIX account has been established, you will have minimal
access to scidac. One of the first things you should do is run this
command:

*makepasswd cvs_passwd*

In this example, "cvs_passwd" is whatever password you want to use [with
your CVS account]{.underline}. The output from this command will be some
encrypted string. Please save the output of this command to a file
called "cvspasswd" in your home directory on scidac. Once you have done
this, please send e-mail to
[*mplee@sandia.gov*](mailto:mplee@sandia.gov) to inform me that this
step has been done. Also, in this e-mail, please tell me which group you
belong to (either CMCS or CFRFS). Within one business day, you should
have CVS access on scidac.

Once you have your CVS username and password, please follow these steps
to connect to the scidac CVS server from your client:

1)  First, you need to create an SSH tunnel between your client and
    scidac. The SSH tunnel essentially links a given port on your client
    to port 2401 on scidac. When you run CVS commands on your client,
    the commands are intercepted by SSH and routed through the SSH
    tunnel to the SSHD daemon on scidac (sshd). The SSH daemon then
    forwards the CVS commands to the CVS daemon running on scidac. When
    scidac sends data back to the client, it uses the same secure, SSH
    tunnel. To create this tunnel, open a terminal and type:

> *ssh -L 2401:localhost:2401 <unix_user@scidac>.ca.sandia.gov*

In this example, "unix_user" is your [UNIX user login for
scidac]{.underline}. When prompted for a password, enter the password
you had created earlier. This will establish the tunnel. As long as you
leave this SSH session open, you will be able to securely access CVS
through pserver.

2)  You will now need to set the *CVSROOT* environmental variable to
    make access to the repository easier. First, open a [second
    terminal]{.underline} on your client. The following explains what
    commands you will need to type depending on whether your shell is
    Bourne-derived (sh or bash) or C-derived (csh, tcsh) and whether
    your work belongs to the CMCS or CFRFS groups. These examples assume
    that "cvs_user" is your valid [CVS User ID]{.underline}:

    a.  If you are using a **Bourne-derived shell** (ie sh or bash) and
        are in the **CMCS group**, type the following in a
        [new]{.underline} terminal:

> *CVSROOT=:pserver:*cvs_user*\@localhost:/data/cvs/cmcs*
>
> *export CVSROOT*

b.  If you are using a **Bourne-derived shell** (ie sh or bash) and are
    in the **CFRFS group**, type the following in a [new]{.underline}
    terminal:

> *CVSROOT=:pserver:cvs_user@localhost:/data/cvs/cfrfs*
>
> *export CVSROOT*

c.  If you are using a **C-derived shell** (such as csh or tcsh) and are
    in the **CMCS group**, type the following in a [new]{.underline}
    terminal:

> *setenv CVSROOT :pserver:cvs_user@localhost:/data/cvs/cmcs*

d.  If you are using a **C-derived shell** (such as csh or tcsh) and are
    in the **CFRFS group**, type the following in a [new]{.underline}
    terminal:

> *setenv CVSROOT :pserver:cvs_user@localhost:/data/cvs/cfrfs*

As an option, you can also edit the appropriate login files to set the
*CVSROOT* variable when you login. This will allow you to avoid step 2a,
2b, 2c, or 2d in subsequent logins.

3)  Now you need to log into scidac's CVS server with your CVS username
    and password. In the [second terminal]{.underline} you created in
    step 2, type the following:

> *cvs login*
>
> This will prompt your for the password associated with your CVS
> username.

You have now logged into the CVS server on scidac. Run all CVS commands
as you normally would [on your client]{.underline} (in the second window
you created in step 2). The results of these commands will securely be
sent through the SSH tunnel to scidac's CVS repository. As long as the
SSH session is open (from step 1), you will be able to use this SSH
tunnel.

# FAQ

The following are some questions (and our answers) that users have asked
concerning the procedures to accessing CVS on scidac. If you have any
questions that are not addressed I this section, please contact me at
[*mplee@sandia.gov*](mailto:mplee@sandia.gov).

Q)  What are those port numbers (e.g. 2401) in the SSH command for?

```{=html}
<!-- -->
```
A)  The first port number is the listening side of the tunnel.
    Basically, any calls to the binded application on the client side
    will be intercepted and forwarded to the target-side-port number on
    the server. This listening-side port must normally be a value
    between 1024 and 65535 because the SSH program responsible for
    listening to the port is running under your user id, not root (the
    first 1023 ports are "privileged" for root use only). The second
    port value is the target side. This can either be privileged or not
    since you are only connecting to the port, as opposed to listening
    on it. Port 2401 is a well-known port value for CVS' pserver
    functionality.

```{=html}
<!-- -->
```
Q)  Okay, but if I do this on two different machines, don't I need to
    use different ports?

```{=html}
<!-- -->
```
A)  No. The situation is analogous to multiple web browsers out in the
    world connecting to the default port 80 of a web server. A
    one-to-many relationship between a client and a given server's port
    number is perfectly legal.