Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running Ubuntu 12.04.2 LTS as virtual machine and there is vShield also at the front with enabled firewall and some NAT modifications. There are also other machines in my VPS configuration, but it is not important right know. Important is that I changed SSH port on Ubuntu from 22 to 765 and on the vShield I made port translation from 424 to 765. Firewall has all the necessary permissions for SSH (and SVN).

So I make SSH conection like this

kopparberg:Webpage marek$ ssh marko@91.***.***.69 -p 424

and it works like a charm.

Where is the problem? I am trying to set up SVN server on Ubuntu following this guide http://odyniec.net/articles/ubuntu-subversion-server/.

If checkout my repository "Webpage" over SVN protocol

kopparberg:Webpage marek$ svn checkout svn://91.***.***.69/Webpage --username svnuser

it works as it should.

What I really want to do, is checkout over svn+ssh protocol. I tried many different ways without success.

kopparberg:Webpage marek$ svn checkout svn+ssh://91.***.***.69:424/usr/local/svn/repos/Webpage --username svnuser
svn: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.
svn: Network connection closed unexpectedly

Another attempt...

kopparberg:Webpage marek$ svn checkout svn+ssh://91.***.***.69/usr/local/svn/repos/Webpage -p 424 --username svnuser
svn: invalid option character: p
Type 'svn help' for usage.

I also add ssh = ssh -p 424 to /user/marek/.subversion/config file.

kopparberg:Webpage marek$ svn checkout svn+ssh://91.***.***.69/usr/local/svn/repos/Webpage --username svnuser
marek@91.***.***.69's password
Permission denied, please try again.: 

None of my password is right.

Is it even possible to checkout with svn+ssh protocol over custom port without modifiying the config file?

EDIT: I found out that I should use SSH user and not SVN user of course. But I was using it on completely wrong way. Instead of --username subcommand I should put my username in front of IP address.

kopparberg:Webpage marek$ svn checkout svn+ssh://marko@91.***.***.69/usr/local/svn/repos/Webpage

This looks much better and it works! What I am still searching is a solution where I will not need to edit config file before checkout. In other words I would like to change the SSH port on the fly.

share|improve this question
Why are you trying to use port 424? You should be using the SSH user, not the svnserver user, for SSH authentication. What's in the server's auth log when you fail to connect via svn+ssh using the marko user? –  Shane Madden Jul 27 '13 at 18:21
I am using port 424 because port 22 is denied by the firewall. Yes, the username was completely wrong. Thank you. Please look up my EDIT part of question. –  Marek Jul 29 '13 at 18:37
add comment

1 Answer

I guess I'm a little late to the party here, but I encountered the exact same issue here, and resolved it.

First, decide on your new default SSH port. This will affect SSH in general (ie: when you want to connect to the server via SSH using command line, putty etc. The port cannot be changed JUST for SVN, unless you want to invoke multiple SSHD server instances, which is beyond the scope of the original question).

So, assuming the following:

  • We want everything done over port 123456
  • Your server's IP address is
  • Your router/firewall has opened up port 123456
  • Your router/firewall has setup port forwarding for external port 123456 routing to internal port 123456 for host

Client Side:

Anyhow, first, modify <~/.subversion/config> on the client machine, and under the line titled [tunnels], enter the following line:

ssh = ssh -p 123456

Server Side:

First, you need to setup the new default SSH port. On your SVN server, edit (in the case of Ubuntu) your SVN SERVER config file (note the 'd' after "SSH"): sudo vi /etc/ssh/sshd_config

Look for a line beginning with "Port" (by default, it says "Port 22"), and change "22" to "123456". Save and close the file. Now restart the SSHD server: sudo restart ssh

Assuming your SVN setup is working like how you already described above, you are set. If you insist on translating the port rather than just keeping it intact as a single-port-forward-passthrough rule, just change the SSH port used on the server side in , and you're set. I have tested the above setup from a client outside my LAN successfully via:

svn --username megaman ls svn+ssh://megaman@DrWileysFortress.dyndns.org/usr/local/svn/repos/private

Hope this helps!

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.