0

I've got a local machine, Server A. This server has a public internet connection to Server B and Server C using private Key A. Neither Server B or Server C have access to Key A. However, Server B and Server C share a private network with one another over Network P.

What I'd like to do is use the ssh or scp ProxyCommand option, if possible, to ssh into Server B from Server A and scp files from Server B over to Server C but done through the private network. Network P.

Is chaining scp/ssh commands like this possible? If so, how do I do it?

StevieD
  • 514
  • 8
  • 24
  • This question was very difficult to follow (at least for me). The relevance of A is unclear if B and C share a private network and you want to transfer files between them over that network - why can they not communicate directly? – tater Dec 09 '20 at 01:52
  • Because they don't have the private key, Key A. So B can't log into C. – StevieD Dec 09 '20 at 02:18
  • You cannot use the private network unless you have an access mechanism. Either create another key or route traffic via A. – tater Dec 09 '20 at 06:52
  • @tater I found a solution. Not sure if it's the idea one but it works. See answer below. – StevieD Dec 09 '20 at 08:27
  • Actually, I have no idea if that is transferring files from Machine B to Machine A over the private network then down to my local machine over the pbulic netwrok, and back up to A over the public network or if it is just going from Machine B to A. – StevieD Dec 09 '20 at 08:40

1 Answers1

0

I somehow managed to pull it off with this monstrosity:

scp -3 -o StrictHostKeyChecking=no -i ~/.ssh/secret.pem -o \
ProxyCommand="ssh -o StrictHostKeyChecking=no \
-i ~/.ssh/secret.pem -W %h:%p admin@205.85.32.42" \
admin@192.168.1.5:/home/admin/file.pdf admin@192.168.1.6:/home/admin
StevieD
  • 514
  • 8
  • 24