tags:

views:

1692

answers:

3

I was trying to copy a file from remote server using SCP but its giving the following error.

bash-3.2$ scp username@server:main.php C:\main.php

ssh: Could not resolve hostname C: hostname nor servname provided, or not known

Its assuming C: as hostname but its just the drive name..Please let me how to specify explicitly like some escaping to get rid of this issue.

If i don't specify the path where to save on local desktop,its working fine.

bash-3.2$ scp username@server:main.php main.php
main.php                                                                   100%   29KB  28.9KB/s   00:01

Appreciate any help.. Thanks in advance,

PS: Using Windows XP SP2

+3  A: 

If you are using Cygwin's scp, you might try using the Cygwin paths:

scp user@host:main.php /cygdrive/c/main.php

(though I'm not sure if it's /c/ or /cygdrive/c/ or whatever; I personally hate Cygwin.)

Or you could use the pscp and psftp commands included in the PuTTY package; they don't complain about Windows paths.

(Or use a GUI.)

grawity
It's actually /cygdrive/c .
Adam Rosenfield
Ah, thanks. [updates]
grawity
A: 

@grawity is right. In the future, you can run also

pwd

to find out what directory you're in, so that you can figure out the correct path to the directory you want according to cygwin.

Marquis Wang
+1  A: 

Use PSCP.exe

The problem you are having is because you are referencing your windows xp drive from the shell which you cannot do. You are logged on remotely to a machine so unless your windows xp box has a ssh server running in which case you would use login and pw info for the destination location, you will cannot do that.

Using pscp.exe (free) you can do what you want.

kevin bailey
Thanks for all your quick help.pscp solved my problem.
Naga Kiran