Posted By

ntamas on 11/19/08


Tagged

Bash ssh


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jamesming
esritter


ssh directly to a machine behind a gateway host


 / Published in: Bash
 

Scenario:

  • You are at home and you want to access your development server (mydevbox) at your company via ssh.
  • You can't access the machine directly due to the company firewall which allows external access to only a dedicated gateway host (gateway).

The script below allows you to ssh directly to your dev box by piping the data stream through the gateway. Just save it in /usr/bin/sssh and use sssh mydevbox whenever you're not behind the gateway. Also works with scp, just replace ssh with scp in the script. You must have nc or netcat installed on the gateway.

  1. ssh -oproxycommand="ssh -q gateway nc %h %p" $*

Report this snippet  

You need to login to post a comment.