Linux – How to copy file from Windows laptop to Linux remote virtual server

debianlinuxscpsshwindows

There are already quite a few topics on this issue here on SuperUser. However, I have spent the last 3 hours trying all of them, but am unable to fix this.

I am trying to copy a file from my laptop to a remote Linux server.

My laptop uses Windows 8.1, the remote server is Debian. I am connected to the Linux server via a PUTTY.

If I was using a Linux machine, it would be as easy as A-B-C. But, as my laptop is Windows… well…

Here is the command I've tried :

pscp C:\Users\Michael Storm\Desktop\Folder\public_key.ppk mstorm@my.linux.server:/home/mstorm
  • mstorm — my username on the linux server (and also my home-directory)
  • public_key.ppk — the file I'm trying to copy to the linux server
  • C:\Users\Michael Storm\Desktop\Folder\public_key.ppk — the filepath (on my laptop)

(Just to be clear: there is a space-break between public_key.ppk and mstorm. This forum carried over the second half of my command to the next line)

This command gave me the error:

UNKNOWN COMMAND PSCPP

So, I changed "PSCP" to "SCP", and I got the error:

ssh: Could not resolve hostname C: Name or service not known Permission denied (publickey).
lost connection

Best Answer

Make it easy on yourself and use WinSCP, WinSCP is an open source free SFTP client, FTP client Its main function is file transfer between a local and a remote computer. and integrates well with putty

WIN SCP Download link

if you really want to use PSCP then to use pscp you will need to ensure you set path or command from putty folder where pscp.exe is i.e.

set PATH=C:\path\to\putty\directory;%PATH%

my set path was "set PATH=C:\Program Files\PuTTY;%pscp.exe% "

Related Question