5

I've managed to do ssh tunnel just for two hops

ssh -L 1234:serverB:22 user@serverA

scp -P 1234 user@localhost:/file /file

Now I need to go from localhost -> serverA - >serverB ->serverC

And to copy files between localhost and serverC

lbanz
  • 1,609
  • 5
  • 20
  • 30

1 Answers1

3

This way:

ssh -L 1234:localhost:1234 user@serverA

Then, from serverA:

ssh -L 1234:serverC:22 user@serverB

So your local port 1234 will tunnel to serverA, from which it will tunnel to serverB, and finally to sercerC:22.

Lacek
  • 7,233
  • 24
  • 28