ssh jumphost

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a server B that can only be accessed by going through server A.
The normal steps are:

1) ssh from my desktop to server A
2) ssh from server A to server B

I want to streamline that process a bit, so I edited ~/.ssh/config to
add the lines:

Host B
Hostname A
LocalCommand ssh -A -t B

Host *
PermitLocalCommand yes

That works, but I cannot ever get out of host A. In other words, from
my desktop I type

ssh B

and lo, I get connected to B. However, when I type "exit" on B, I get
dropped to A, and I cannot ever leave. Every time I type "exit" on A,
I immediately get logged back in to A again.

What am I doing wrong?


Re: ssh jumphost

Thomas Knox schrieb:
Quoted text here. Click to load it

I never tried that, but i think when you exit on B control is given back
to A and on A you carry out the only allowed command: ssh -A -t B

Maybe ssh -A -t B; exit

might work - i did not test it. There is a way to jump to B using
ProxyCommand. Therefore, nc (netcat) should be installed on A:

Try to rewrite your local ~/.ssh/config to

Host B_through_A
  Hostname B
  HostkeyAlias B # not sure, wether that is necessary or not
  ProxyCommand ssh A nc %h %p

and then type

ssh B_through_A

you might want to read man ssh_config and look for ProxyCommand to
understand this.

Quoted text here. Click to load it


Re: ssh jumphost

Quoted text here. Click to load it

That worked. Danke!

Site Timeline