-2

Say I have an svn host on a private network that we will call my_work_svn. I cannot access this from externally but I can access it from a machine which we will call my_work_ssh (and assume I am working from a computer called my_home).

Now If I want to checkout the repository I can do:

ssh my_work_ssh
svn co my_work_svn/master my_checked_out_repo
# CTRL+D to quit ssh session from my_work_ssh
scp my_work_ssh:my_checked_out_repo my_local_repo

but this seems long and convoluted, how do I do this with one command?

Mike H-R
  • 113
  • 1
  • 6

1 Answers1

2

This can be simplified by utilizing ssh tunneling (and or ProxyCommands)

This lives in .ssh/config. If you are no windows no idea.

  • define your bastion host Host my_work_ssh Hostname some.hostname.com User usename IdentityFile ~/.ssh/id_rsa_work_ssh

  • Define your svn

Host my_work_svn HostName svn.internal.domain IdentityFile ~/.ssh/root/id_rsa_work_ssh ProxyCommand ssh my_work_ssh exec nc %h %p 2>/dev/null

  • Connect at least once to my_work_ssh and my_work_svn and copy the known_hosts entries to your desktop.
  • now you can execute ssh my_work_svn from your desktop machine and the following will happen:
    • you will be automatically connected first to my_work_ssh
    • an nc session will be opened to my_work_svn
    • all communication will be forwarded over this nc session

The end effect is that you are using intermediate host to jump around the FW. This works for both ssh and scp (and svn+ssh is just ssh and svn commands inside it).

Please note:

  • Public keys setup is preferred and faster
  • ProxyCommand is sometimes picky
  • AgentForwarding must be enabled on my_work_ssh machine
zeridon
  • 760
  • 3
  • 6
  • brilliant, this is exactly what I was looking for, can I just check a couple of things? so using `nc %h %p` is basically `netcat host port` which will pipe any files/whatever that I pipe to my home computer? is that right? I couldn't also ask you what you think might be wrong with my question? I hadn't been able to find a solution and I thought this was the correct site to post it on, isn't it? thanks again. – Mike H-R Jun 10 '14 at 13:14