3

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

  • 2
    simple solution; use WinSCP. just connect and copy the file over. – Frank Thomas Nov 23 '15 at 15:57
  • Although not related to the error: Arguments that contain spaces must be enclosed in quotes, like this: pscp "C:\some path\file.txt" "user@host:/some folder". – Daniel B Jul 25 '17 at 10:27
5

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% "

2

Use WinSCP!!.


What is SFTP?

In computing, the SSH File Transfer Protocol (also Secure File Transfer Protocol, or SFTP) is a network protocol that provides file access, file transfer, and file management over any reliable data stream.

Source Wikipedia


What is WinSCP?

WinSCP is an open source free SFTP client, FTP client, WebDAV client and SCP client for Windows. Its main function is file transfer between a local and a remote computer. Beyond this, WinSCP offers scripting and basic file manager functionality.

Source WinSCP Website.


How it works?.

Just do the following steps.

  • After install WinSCP just press Start Icon and search for the installed program.

enter image description here

  • It will open the following screen, there just Press "New" Button.

enter image description here

  • After that just select the Protocol at this case default is SFTP and fill the fiels with the following information.
    • In the red box put the IP Address or DNS name.
    • In the orange box put your Linux host User.
    • In the green put the password.
    • Then press Connect

enter image description here

  • After that you will see a kinda "commander" window and there you can drag and drop between your windows and linux host.

enter image description here


P.S.

Srry my current configuration it's spanish.

1

Set the PATH and then try, else first locate the file pscp.exe on cmd. you have to run the above command in same directory.

Example - if you have pscp.exe on your desktop, then run cd C:\Users\<your_username>\Desktop first and then run your command -

pscp C:\Users\Michael Storm\Desktop\Folder\public_key.ppk mstorm@my.linux.server:/home/mstorm

You can also give password here also, instead of giving later -

pscp -pw <password> C:\Users\Michael Storm\Desktop\Folder\public_key.ppk mstorm@my.linux.server:/home/mstorm
0

There is an easy solution for this question using the Command Prompt in Windows.

The problem looks in the '\' in the command. Just replace '\' by '/' in Command Prompt and the command should work.

In your case, the command becomes:

pscp C:/Users/Michael Storm/Desktop/Folder/public_key.ppk mstorm@my.linux.server:/home/mstorm/Desktop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.