0

I'm new to working with a remote server. I am trying to get a file to be copied from my local machine (Windows 10) to a Ubuntu server. I'm using ssh with PuTTY.

What I try to do is this:
scp D:\USER\Desktop\test.txt username@server:home

I get :

ssh: Could not resolve hostname d: Name or service not known

So I tried a couple of other things such as:

scp Desktop/test.txt username@server:home

Which returns:

Desktop/test.txt: No such file or directory

Of course, there is an existing text file test.txt in my desktop.

I have the feeling I can't work out how to format the Windows path...

Mysterry
  • 233
  • 3
  • 10

1 Answers1

2

Assuming D is the drive you installed windows on the syntax would be

scp D:\Users\YOURUSERNAME\Desktop\test.txt USERNAME@remoteserver:~/Desktop/test.txt

The backslash for your windows path is okay, use forward slashes for the ssh remote server path

If you have a private key with which you can connect to the remote server you can provide it with the -i flag

scp -i ~/.ssh/privatekey.pem D:\Users\YOURUSERNAME\Desktop\test.txt USERNAME@remoteserver:~/Desktop/test.txt

The standard port for an ssh server would be 22 if it is another port than provide that with the -p flag e.g. -p 2222

Double check if the remote host is reachable e.g. use nmap or zenmap and port is open. Good luck.

PS: There is also a Putty Secure Copy program available through the pscp utility. You can launch it separately from putty in the command prompt

the syntax for that would be a forward slash for your local windows folder too e.g.

pscp c:/music.mp3 ubuntu@10.0.0.3:/home/ubuntu/Music

  • Thanks for your suggestion! So Windows is installed on my C: drive in fact, but my desktop (and thus the file I want to move) is on my D: drive. Does that change anything? Unfortunately I still get "Could not resolve hostname d: Name or service not known" with your suggestion. The host is reachable, I can move or copy files remotely via ssh for example. – Mysterry Aug 18 '17 at 11:24
  • so do you work with password authentication or a private key to authenticate with the remote ssh server? – Patrick Brunswyck Aug 18 '17 at 11:28
  • It works with a password authentification. But I just tried your edited suggestion with pscp directly in command prompt, and it works perfectly! It doesn't explain why scp fails, but it's doing what I wanted to do! Thanks a lot! – Mysterry Aug 18 '17 at 11:31
  • make sure that putty recognizes the full path to the other drive. It looks like putty is unable to recognized the D: drive try typing d: to switch to the drive first – Patrick Brunswyck Aug 18 '17 at 11:39
  • Typing d: in putty gives me "d:: command not found" and doesn't switch the drive unlike in a normal command prompt. – Mysterry Aug 18 '17 at 11:44
  • I looked for more information and this [link](https://stackoverflow.com/questions/22127092/how-to-download-a-file-from-my-server-using-ssh-using-putty-on-windows) answers your question you might be able to do so by providing a path like this one as mentioned in the post `%USERPROFILE%\Desktop` – Patrick Brunswyck Aug 18 '17 at 11:55