0

I can ssh to multiple servers but once I've reached one of them, I can't ssh to the next I have to go back to my local machine and then ssh to the next server. I would like to set up a script that lives on each these servers that can exit and then ssh to the next arbitrary server. I've tried setting up an alias for this.

like so: alias host2="exit; ssh host2;"

that didn't get me anywhere, Then I spent a long time looking into the localcommand config for ssh and I don't think that can help me either. Most recently I've been looking into writing a script that suspends the ssh instance and drops you local again, but I can't seem to get the formatting right for echoing ~ ^Z. Even if I could I'm not sure it would help. Now my only thought is that maybe the remote server could scp the host name to a shared location and once back I could check that file if it has anything I use that as my next server. But I'm guessing there is a way easier way. Anyways any ideas or insights would be much appreciated thank you!

gnarlyninja
  • 101
  • 1
  • Similar: https://serverfault.com/questions/337274/ssh-from-a-through-b-to-c-using-private-key-on-b – Gerald Schneider Jun 06 '19 at 08:07
  • It is strange that you cannot re ssh to another server. Are you using keys to log on to your servers? If so, you you can set up ssh keys between your servers. Is there perhaps a firewall stopping SSH from these servers (different subnet maybe?) Regards, Leslie – Leslie Jun 06 '19 at 11:02

0 Answers0