0

I have encountered SCP through SSH-forwarding in cases where

VM-A <---> VM-B <---> VM-C 

and a file is needed to be transferred from A to C or vice versa, ie. B is the Jumpbox in this scenario.

In my case, through my localhost, I have access to 2 VMs and I want to share files between them.

VM-A <---> VM-B VM-A <---> VM-C 

and file transfer needs to be done between B and C. (A is my localhost where I can run SSH commands)

Now, one way to this is:

  1. SCP from B to A, then SCP again from A to C.

However, since SCP command just takes source & destination as inputs, I thought simply this would work:

scp user@VM-B user@VM-C 

if I run this on A, since A has necessary authorisations. However, this results in:

Host key verification failed. lost connection 

So, what is the way to overcome this and move data from B to C directly?

2 Answers 2

1

move data from B to C directly?

That's actually the problem – scp is trying to make VM-B connect directly to VM-C, bypassing VM-A.

You want the transfer to be done indirectly, which is done using the -3 option for scp.

scp -3 user@VM-B user@VM-C 

(In current OpenSSH versions this is now the default, with -R enabling the old direct mode.)

0
0

You could set up your VM's network settings with 'bridged' connections instead of a NAT. This will make your VM's live on the same local network as your host machine with their own local ipv4 addresses so then they can directly scp to one another that way.

If you want to do that go to each VM's 'settings' -> 'network' -> 'attached to'

But if you want to keep your VM's on an isolated nested network under your host machine this won't work for you.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.