0

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.