Using subversion over ssh gate server

If you have the same problem like me, connecting to a svn server that is only reachable over a gate server, try this:

  • Add your root public ssh key to the ~/.ssh/authorized_keys on the gate server.
  • And your user public ssh key to the ~/.ssh/authorized_keys on the svn server.
  • Try this: ssh -L 24:<svn_server>:22 <gate_login>@<gate_server>
  • Now nmap should show something like this:
  • doep ~ # nmap localhost
    24/tcp    open  priv-mail
  • You can also create an init script. /etc/init.d/sshtun
  • #!/sbin/runscript
    SSHTUN_OPTIONS="-L 24:<svn_server>:22 <gate_login>@<gate_server> -N"
    depend() {
    need net
    start() {
    ebegin "Starting sshtun"
    start-stop-daemon --start --quiet --exec /usr/bin/ssh --background \
    --pidfile /var/run/ --make-pidfile -- $SSHTUN_OPTIONS
    eend $?
    stop() {
    ebegin "Stopping sshtun"
    start-stop-daemon --stop --quiet --pidfile /var/run/
    eend $?
  • Don’t forget to make it executable:
  • doep ~ # chmod +x /etc/init.d/sshtun
  • Then start the ssh tunnel:
  • doep ~ # /etc/init.d/sshtun start
  • To create the tunnel on startup, use rc-update:
  • doep ~ # rc-update add sshtun default
  • Now open your ssh config ~/.ssh/config and add a new server:
  • Host svn
    HostName localhost
    User <svn_user>
    Port 24
  • If you have already checked out a repository you can easily change the location:
  • doep@doep ~ $ svn switch --relocate http://<svn_server>/svn/repository svn+ssh://svn/var/svn/repos/repository
  • Otherwise check it out:
  • doep@doep ~ $ svn co svn+ssh://svn/var/svn/repos/repository
VN:F [1.9.22_1171]
Rating: 6.0/10 (3 votes cast)
Using subversion over ssh gate server, 6.0 out of 10 based on 3 ratings

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Wir benutzen Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu.