Howto ssh tunnel

From ImageWiki

Jump to: navigation, search

If you want to make a ssh tunnel to image.diku.dk or some other machine from a cluster machine (so you can use scp directly or SVN) you have to do the following.

On your favorite imagediskserver execute this command:

 ssh -L 15000:image.diku.dk:22 ask.diku.dk -N

This makes a ssh tunnel via ask.diku.dk to image.diku.dk using the local port 15000 (WARNING: Don't use this port number but use a random number above 15000, e.g. your birthday or your dogs). Beware that this commands blocks, and if you kill the process the tunnel will close.

You can now copy files using scp from the imagediskserver to image.diku.dk:

 scp -P 15000 myfile localhost:mydirectory_on_image/

If you want to access imagediskserver2 from your local machine, do this:

 ssh -L 15573:192.168.10.102:22 ask.diku.dk -N

This opens a ssh tunnel on localhost port 15573 to imagediskserver2. You can now do scp directly to imagediskserver2:

 scp -P 15573 myfile localhost:mydirectory_on_image/

WARNING: As before change the port number to your favorite random number larger than 15000.

SVN and ssh tunnels (Work in progress)

You can check out svn repositories via the http protocol, by first making a ssh tunnel to the repository server forwarding port 80 (http port):

 ssh -L 15573:www.opentissue.org:80 ask.diku.dk -N

You can now checkout the infamous OpenTissue library by:

 svn checkout http://localhost:15573/svn/OpenTissue/sandbox OpenTissue


Howto use the svn+ssh protocol

You have to change the way svn uses ssh. You can do this by adding a new protocol to svn.

Add the following to the file ./subversion/config

 [tunnels]
 ### 'svn+sshtunnel':
 sshtunnel = ssh -qp 15573

Remember to change the port number to your favorite, e.g. your birthday or something similar.

Now open an ssh tunnel on this port

 ssh -L 15573:image.diku.dk:22 ask.diku.dk -N

You can now checkout whatever you want from svn on image.diku.dk:

 svn checkout svn+sshtunnel://localhost/svn/MyRepos/trunk .
Personal tools