0

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?

Quasímodo
  • 18,865
  • 4
  • 36
  • 73
bjk116
  • 121
  • 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 '21 at 14:07

1 Answers1

-1

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

Then from that other computer instead do

scp readme brian@10.1.2.3:/home/brian/Documents/

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

10.1.2.3  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 10.1.2.3. 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.

ron
  • 6,575
  • 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 '21 at 11:46