Beware the Mathematician

Two-Hop SCP

In Geekery on June 16, 2011 at 12:34 AM

The University of Otago has a fairly anally-retentive firewall configuration. SSH in or out is strictly verboten. However, mail servers do allow incoming SSH connections, and once in, it’s easy to SSH into my machines in my office. The problem comes, however, with trying to use SCP. The mail server won’t let me copy files to outside the otago.ac.nz domain, and I can’t SSH into my machines directly.

After much hunting, I have found the solution. This will work for any two-hop SCP.

scp -Cp -o "ProxyCommand ssh gatewayuser@gateway nc remotehost 22" remoteuser@remotehost:/path/to/file/on/remote /path/to/file/on/local

Here, I use the term ‘gateway’ for the mail server, and ‘remotehost’ for the machine in my office.

Problem solved.

Advertisement
  1. What a screwball way to have to do it.

    Otago uni. are just plain weird when it comes to internet access.

  2. Yeah, tell me about it. That firewall is the goddamned bane of my existence.

    Anyways, hopefully someone finds this multi-hop SCP useful anyway.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.