nz_21
nz_21

Reputation: 7383

scp unable to resolve hostname on Mac

I am on a mac and I have sshed into a remote computer, A. I want to transfer a file from A to my mac.

I tried scp myfile.txt myusername:

I got an error:

ssh: Could not resolve hostname {myusername}: Name or service not known.

How do I fix this?

I got my username by typing id -un

Upvotes: 0

Views: 1981

Answers (1)

Gokul
Gokul

Reputation: 191

The right syntax would be.. From remote computer A, you have to run the following command

scp myfile.txt yourusername@<ip_addr or hostname of your mac>:/dest/path

Or instead from your mac, you can run the below command without logging in the remote machine

scp remoteusername@remotecomputerA:/path/to/myfile.txt ./

Upvotes: 2

Related Questions