[CentOS] Re: ssh with proxy?

Thu Nov 1 14:26:26 UTC 2007
Nicolas Thierry-Mieg <Nicolas.Thierry-Mieg at imag.fr>

Scott Ehrlich wrote:
> What is the recommended way to ssh through a proxy?  I've been using 
> putty, compiled from source, as it has a proxy option, but a native option 
> would be very nice.

If I understand what you want to do, you can use the builtin ssh 

Let's say you want to connect from your home machine to various machines 
in the .imag.fr domain, going through sshgate.imag.fr (the only host in 
imag.fr that is accessible by ssh from the outside).

On the home client, make a file called config in your ~/.ssh/ dir.

Mine looks something like this:

[nico at localhost ~]$ cat ~/.ssh/config
Host *.imag
User nico
ProxyCommand ssh nico at sshgate.imag.fr "nc $(basename %h .imag) %p"

Then I can type "ssh host1.imag", and it works. It's also fine with 
sftp, scp, and pretty much anything that runs over ssh.
nc has to be installed on sshgate, but it most probably is (might be 
called netcat).
You have to type 2 passwords unless you use ssh key authentication, 
which you should (at least between home and sshgate).

hope this helps.
Nico TM