Tag Archive for 'ssh'

Custom SSH port with svnserve

I had some trouble accessing my svn repository on my server.  The people who host my website use a non-standard SSH port, and they force you to access the svn server through SSH - but without telling svnserve to use the non-standard port!

So, after much trawling through the internet, I finally found the solution, thanks to this page.  Their solution didn't quite match my needs (as they assume root access for the Linux shell, which I don't have), but it got me over the hump.  Their solution is to set the global variable $SVN_SSH, '
It seems like the environment variable is the only way to set the SSH port.'

However, this is wrong - there is another way, and it is more elegant, I think.

The subversion configuration file settings on a standard Linux setup can be found in the '.subversion' directory.  In this folder you can find the 'config' file.  Open this, and you will find the '[tunnels]' section.  Add the following code to that section:

custom_ssh = $SVN_SSH ssh -p 12345

This creates a custom ssh access protocol which is identical to the standard one, except with a different port number.  If you want to specify a different (or non-ssh) protocol you can do that too.  More details can be found here.

To access the repository now, you simply use this:

$ svn co svn+custom_ssh://username@server_ip/path/to/repos/ .

instead of this:

$ svn co svn+ssh://username@server_ip/path/to/repos/ .

Problem solved!

Eclipse and Subversion over SSH

I use subversion for my version control - and I have recently had to set up Eclipse to access the subversion repository on my new server. This proved trickier than expected, largely because of bad instructions all over the internet!

Many of them provide instructions for setting up a tunnel in putty, or through TortoiseSVN. Both are unnecessary with the right Eclipse setup.

These instructions assume you have setup a repository on your SVN server, and have imported files into it. For instructions on how to do this, please go here:

SVN QuickStart

First, you need to install WebTools (WTP) and Subclipse in Eclipse. I use the PHP Development Tools (PDT) plugin to edit PHP scripts - the PDT 'all-in-one' package comes with WTP pre-installed. Instructions for installing Subclipse can be found here:

Subclipse Update

Once you have everything installed, open Eclipse and go to the Window... Preferences.

Navigate to Team > SVN and set 'SVN interface' to 'SVNKit (Pure Java)'. Click OK.

Now go to Window...Open Perspective...Other... Select 'SVN Repository Exploring' and click OK.

In the 'SVN Repository' window, right-click and select New... Repository Location.

The URL is in the format:

svn+ssh://username@server_ip_address/path/to/repos/username is the username you use to log onto your server over SSH
server_ip_address is pretty obvious.. I find IP addresses work better than domain names
/path/to/repos/ is the full filesystem path to the repository (e.g. /home/ben/svn/)

Click 'Finish' and you will be taken to the 'Enter SSH Credentials' page.

Your username will be pre-filled. Select 'Use password authentication', and enter your password. Ensure that the port information is correct. The default is 22, but if your server is behind a firewall it is likely to be something different. Check 'Save Information' if you want to, and click OK.

Eclipse will now load your repository in the 'SVN Repository' window. For instructions after this point, check out the SVN QuickStart (the link is earlier in the post).