CVS over SSH on a Non-Standard Port

If you access CVS over SSH you will know that you have to do two things to get it working. Firstly, you have to set the CVS_RSH environment variable to the location of your SSH binary. Secondly you have to use the :ext: scheme for the CVSROOT environment variable (or -d flag). The thing is, there is no place in the :ext: scheme to set a port number! This means that CVS will try to open the SSH connection to the specified server on the standard SSH port. I don’t like running SSHD on the standard port, I much prefer to stick it on a non-standard port, but does that mean I can’t use CVS over SSH? Well, if you leave things to CVS then yes, but luckily OpenSSH is not as retarded as CVS and provides you with a simple mechanism for over-ridding the default port on a per-host basis. The key is to add an entry for the host in question to your ~/.ssh/config file. The sample below tells SSH to use port 123 as the default port when connecting to the server my.machine.ie:

Host my.machine.ie
Port 123

This will work on Unix, Linux and OS X as well as through Cygwin on Windows.

[tags]SSH, CVS, OpenSSH[/tags]