For a while I have been wanting to access the CVS server in my laboratory intranet from home, but I never got around learning how to do that. Until today, that is. Here is the short version. First you make a tunnel to the CVS server through the gateway server:
$ CVS -f -L 10000:cvs:22 iba.t.u-tokyo.ac.jp -N
Then you edit .ssh/config to setup the ssh alias. Write the following in the file (create it if non-existant):
host cvsalias
hostname localhost
port 10000
username caranha
Finally you can connect, using ‘-d’ to override your normal CVS root configuration:
$ cvs -d :ext:caranha@cvsalias:/usr/local/home/cvs update
Some notes about the above:
- It eluded me for a while that the tunnel command had to be done from the computer which you are accessing from,
not the computer which will actually act as the “tunnel” – duh! - The -f and -N options in the ssh command allow for the SSH tunnel to keep running in the background, so you don’t have to keep a terminal window open.
- For some bizarre reason you cannot tell CVS which port you want to use in the SSH connection when using the :ext: protocol. Even if you change the CVS_RSH variable to “ssh -p something” or create a shell alias, you’ll get an error – so you need to edit the ssh config file.
- If for some reason you want to use the :pserver: protocol instead of :ext:, change the cvs:22 to cvs:2014 in the tunnel command line (and :ext: to :pserver: in the cvs command line, of course).
- While I checked a bunch of websites until I got to the final solution above, this one also has all the steps needed (and a bunch of other information): http://www.cse.scitech.ac.uk/ccg/misc/cvs_remote.html
- Another very useful site I found while googling this (not related only to CVS) is this small compilation of Unix hints and tricks: http://cb.vu/unixtoolbox.xhtml