Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to setup some sort of configuration on my laptop , so I'd be able to connect to a server using SSH , directly , which i have indirect access to , i've found a great configuration here : so sofar i've made this configuration :

Host terzo , gw02, ipsec

ProxyCommand ssh zenoss nc -w 10 %h %p

but i want to be able to ssh to forinstance zenipsec , and it'd directly go through zenoss

I'm hoping to create something like this :

Host zen*

ProxyCommand ssh zenoss nc -w 10 %h `echo %h | cut -f2-100 -dn`

i guess the last part `echo %h | cut -f2-100 -dn` , doesn't work . can anyone help ?

share|improve this question

A useful configuration which I use is this:

Host *%*
    ProxyCommand ssh $(echo %h | cut -d%% -f2-) nc $(echo %h | cut -d%% -f1) %p

It allows you to setup arbitrary hops by separating the hosts with the % sign. For example, ssh zenipsec%zenoss would hop through zenoss to get to zenipsec.

share|improve this answer

You are telling netcat to use zenipsec as host and ipsec as port. The following should be correct:

nc -w 10 `echo %h | cut -f2-100 -dn` %p

A much cleaner way to do this is to write a script that acts as a ProxyCommand; for example, ~/bin/proxycommand-zen

exec ssh zenoss nc -w 10 ${host#zen} $port
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.