I am ssh'd into a computer. There is a file on the home directory I would like to copy to my local computer. I tried running

scp readme brian@HomeLenovo:/home/Documents/cp_readme

where brian@HomeLenovo is my peronsal laptop, but I keep getting the error

ssh: Could not resolve hostname homelenovo: No address associated with hostname
lost connection

I assume this is because the computer I am ssh'd into doesn't "know" about my computer or what that hostname references - how can I resolve this without installing anything or making changes to the computer I am ssh'd into?

  • 2
    The usual approach is to issue scp brian@remoteMachine:/path/readme /home/Documents/cp_readme from your homeLenovo machine. You can also use fuse-mounts to make this process less burdensome.
    – Quasímodo
    Feb 11, 2021 at 14:07

1 Answer 1


on your HomeLenovo laptop, type ping HomeLenovo and get its IP address. For example it comes back and says

Then from that other computer instead do

scp readme brian@

Or you may edit the local /etc/hosts file on that computer you are ssh'd in to provided you have root permission to do so. Then add the line  HomeLenovo

and then from that computer it would then know how to resolve the hostname HomeLenovo to some ip address... because you manually told it what it was and then your original scp command using the hostname would work.

note: don't use I used that as an example. Use the ip address that responds from HomeLenovo simply pinging itself, that's probably the easiest & fastest way to get that.

  • This assumes that HomeLenovo is a server and that it is in a local area network. There is no indication in the question that any of these are true.
    – Quasímodo
    Feb 12, 2021 at 11:46

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