Eran
Eran

Reputation: 844

ssh ProxyCommand fails: "forbidden char/command over SSH"

I am trying to ssh over my university's proxy server, to one of our lab's servers. The goal is to automate it with paramiko, but I am trying to first understand what's happening in the terminal level.

I tried

ssh -o ProxyCommand='ssh eran@proxy_server nc inner_server 22' eran@inner_server

And got

*** forbidden char/command over SSH: "nc inner_server 22"
This incident has been reported.
ssh_exchange_identification: Connection closed by remote host

Which I guess means the server does not allow the ProxyCommand.

Any way to achieve this in a different way? Just to be clear, ssh to proxy_server, and then to inner_server, works fine, but doesn't produce a paramiko SSHClient instance, which is what I'm aiming for.

Upvotes: 1

Views: 973

Answers (1)

Jakuje
Jakuje

Reputation: 25936

Do not use netcat. It is probably not allowed on the proxy server. Use -W switch:

ssh -o ProxyCommand='ssh -W %h:%p eran@proxy_server' eran@inner_server

Upvotes: 2

Related Questions