1

I want to move a directory from one host to another. This is my command:

scp -r host1:filepath host2:filepath

I get this error:

ssh: Could not resolve hostname host2: Name or service not known
lost connection

host1 and host2 are present in my ~/.ssh/config, and I can connect to them with ssh host1 and ssh host2 without problem.

Why does scp fail to connect to host2?

1 Answer 1

2

I just found that host1 needs to be able to connect to host2 for this to work. The details are in another answer.

1
  • scp -r -3 host1:filepath host2:filepath will work Jul 14, 2022 at 10:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .