Mark
Mark

Reputation: 3197

could not resolve hostname with scp

I am accessing an ubuntu server over ssh with putty on my windows machine and trying to download a single file to my local windows machine

my windows username is Mark and my hostname per cmd is Marks I am trying the following command on the remote server

scp backup.sql mark@marks:desktop

and I get could not resolve hostname I have tried to put in what I think myip address is and the connection times out

Upvotes: 18

Views: 92501

Answers (4)

Hamisi Jabe
Hamisi Jabe

Reputation: 59

I experienced the same issu, what i did is move one step back and run the command again

so if the command is like this

scp the_file me@host_to:~/

i changed to the back directory

cd ..

then scp ./the_file me@host_to:~/

and worked fine

Upvotes: 0

mti2935
mti2935

Reputation: 12027

binarysubstrate is right about the syntax. The problem is, if the OP puts the name (or address) of his windows client in the 'to' part of the scp command, it probably won't work for a number of reasons:

  1. his windows machine may not have a resolvable FQDN,
  2. his windows machine may be behind a NAT firewall that is not setup to port-forward SSH requests,
  3. he probably does not have an SSH daemon running on his windows machine.

To simply copy a file from the remote server down to a windows client, I would recommend WinSCP.

Upvotes: 10

Michelle Welcks
Michelle Welcks

Reputation: 3904

The syntax is this, relative to where you're issuing the command:

scp user@host_from:location/file user@host_to:location/file

And of course if you're local you can omit the user@host prefixes:

scp local_file me@host_to:~/local_file

The direction is always from > to relative to where you issue the command.

Upvotes: 10

PVC
PVC

Reputation: 101

From the ser you ping your machine name ? Try replace machine name for the IP Address, or add your machine name to hosts configuration file from the server.

Upvotes: 0

Related Questions