[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: SSH through another computer



On Wed, Apr 25, 2007 at 00:45:26 +0530, Masatran, R. Deepak wrote:
> I am forced to SSH to host1, and SSH from there to host2.
> 
> How can I do this in a single command?
> 
> I have a private key in localhost, which is accepted for SSH by host2. How
> can I use this key in host2 without storing it in host1?

ssh host2 -o 'ProxyCommand ssh host1 nc -w 1 %h %p'

You can set this up in ~/.ssh/config:

Host somename
  HostName host2
  ProxyCommand ssh host1 nc -w 1 %h %p

Then it should be automatic if you run "ssh somename". "Host1" and
"host2" have to be fully qualified hostnames or IP addresses. "Somename"
can be any abbreviation that you like. (I would avoid special
characters, though.)

It is not necessary to have your private key for host2 stored on host1
if I remember correctly.

-- 
Regards,            | http://users.icfo.es/Florian.Kulzer
          Florian   |



Reply to: