I'm SSHing into a Linux machine using PuTTY and trying to copy a file down somewhere (anywhere) to my local machine. I figure SCP is the best candidate for the job but don't really care, so long as the solution works!

I cd to the directory containing the file I want (app.war) and type the following:

scp app.war ./

I've tried both to no avail:

scp app.war ./C:/Users/myUser/
scp app.war ./Users/myUser/

It got me thinking that perhaps SCP is a client/server tool and requires a client on my Windows machine, which isn't there.

Am I just using the wrong syntax? Or am I way off-base? If so, what options do I have? Thanks in advance!

  • The real answer to this question is here : stackoverflow.com/a/23412501/1579667 . Syntax is scp some_file user@host:/c/temp
    – Benj
    Commented Jul 2, 2015 at 8:12
  • Also see Bitvise SSH client and server. It is one of the oldest SSH software for Windows. The client is a free download and free to use.
    – jww
    Commented Sep 10, 2019 at 0:24

11 Answers 11


in order for you to copy files back to your Windows you need SSH daemon/service to be running on your Windows, it's much easier to use this tool instead, it has an ability to import sessions from Putty, very plain forward client you'll love it!

WinSCP :: Free SFTP and FTP client for Windows

  • 1
    It does not really answer the original question, which was living in the command-line. See my comment below original question.
    – Benj
    Commented Jul 2, 2015 at 8:14
  • @Benj OP asked for solution, WinSCP is a good solution for that task.
    – alexus
    Commented Apr 28, 2016 at 13:42
  • It still works, but WinSCP tends to freeze up for directories with a lot of files Commented Aug 18, 2020 at 16:42
  • WinSCP is a server too?
    – ocodo
    Commented May 18 at 10:37
  • negative, winscp is a client
    – alexus
    Commented May 22 at 3:35

Windows 10 now has OpenSSH built in. https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse

Get an admin command prompt

Open PowerShell as an Administrator.

Check available versions

Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

Install client

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~

Install server

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~

Start server and enable at boot

Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'

Find your Windows IP address


On your remote (Linux) machine, find your IP address.


Create a public SSH key


Copy public key from local (Windows) to remote (Linux) machine so you don't have to type in a password all the time.

Note that ssh-copy-id is not currently available on Windows.

cat C:\Users\YOU/.ssh/id_rsa.pub | ssh USER@REMOTE_IP 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'

Do the same on your Linux machine (Note, ssh-copy-id does not work)

ssh-keygen # if needed
cat ~/.ssh/id_rsa.pub | ssh USER@WINDOWS_IP 'mkdir -p ~/.ssh && type con >> C:/Users/YOU/.ssh/authorized_keys'
  • The method above did not work for me, so I ended up manually SCPing the public key over and pasting it into the C:/Users/YOU/.ssh/authorized_keys file.

  • That still did not work, so I had to modify the sshd_config file.

    • Open Notepad as Administrator

    • Open %programdata%\ssh\sshd_config

    • Add the following lines:

        Match User YOU
             AuthorizedKeysFile C:/Users/YOU/.ssh/authorized_keys
  • Reboot

Create a password on Windows if you don't already have one

System Settings...Sign-in options

-- Note, you can still disable the Windows login screen by a) Setting the 'Require sign-in' option to never and b) Using the 'netplwiz' command and unticking the 'Users must enter password...' checkbox.

Now you should be able to SSH or SCP from your Linux machine

scp FILE WINDOWS_IP:C:/Users/YOU/Desktop
  • 3
    This bit of syntax is what I came looking for; scp FILE WINDOWS_IP:C:/Users/YOU/Desktop thanks.
    – Johnny5
    Commented Jul 3, 2021 at 15:24
  • This is the correct answer, not that WinSCP garbage.
    – ocodo
    Commented May 18 at 10:38

You are correct. SSHD is the SSH server services that runs on the host. It accepts connections from SSH clients (like PuTTy), SCP clients, and SFTP clients.

You can download pscp from the same website where PuTTY is hosted.

From the windows machine, you would execute a command similar to

pscp.exe [email protected]:/path/to/app.war c:\tmp


If anyone else is in a very locked-down environment, and you can't even install PuTTY, here's what I do:

Transferring files from Windows to Linux (CentOS 7)

On my Windows computer, open a command prompt

scp [local file to send to Linux] [Linux username]@[Linux computer]:[Linux path to save to]


scp log.txt [email protected]:/home/ryanLinuxUser
scp log.txt [email protected]:/home/ryanLinuxUser

Transferring files from Linux to Windows

Again on my Windows computer, open a command prompt

scp [Linux username]@[Linux computer]:[Linux path to existing file] [local Windows path to save to]


scp [email protected]:/home/ryanLinuxUser/log.txt log.txt 
scp [email protected]:/home/ryanLinuxUser/log.txt log.txt 

You can do this by using the Linux Ubuntu subsystem for Windows (you need to enable this as a Windows feature). Then you can use a Linux terminal client that runs on Windows by getting it from the Microsoft Store (e.g. Ubuntu 16.04 LTS). Then, if you have ssh security set up to remote into your Linux machine, you can scp from your local Windows Ubuntu terminal (when logged in as the username that you set for your Linux instance) something like this:

scp -i ~/.ssh/my_rsa [email protected]:~/myfile ~/ ... enter RSA passphrase

The remote file will be copied into your local Ubuntu filesystem used by Windows e.g.


  • 2
    In the latest versions of Windows 10, (Win32-OpenSSH) scp(.exe) is built-in. You do not need to install anything. Commented Dec 5, 2019 at 13:40

To SCP a file to a Windows machine, you need an SSH/SCP server on the Windows.

Since Windows 10, Microsoft build of OpenSSH for Windows is included. It can also be manually installed on older versions of Windows.

I have prepared a guide for setting up SSH/SFTP server on Windows using this Microsoft build of OpenSSH.

See also Is IIS SFTP natively supported by Windows?

Though as you SSH into the Linux server from the Windows machine, you actually can download a file from the Linux server to the Windows server, instead of trying to upload the file from the Linux server to Windows server.

In you have an SSH access from Windows to Linux, you have an SCP access too (or even better an SFTP access).

Use any SCP/SFTP client available.

You can use WinSCP SFTP/SCP client, which has both GUI and command-line interface.

Another alternative is PuTTY toolset, which includes the pscp command-line tool with a syntax similar to the OpenSSH scp command. Also the latest versions of Windows 10 comes with OpenSSH scp built-in and it can be installed on older versions too.

(I'm the author of WinSCP)


on windows,scp file to my server:

C:\Users\admin\Documents>scp Aaaa.docx [email protected]:/tmp

on my server,scp from windows

scp [email protected]:C:/Users/admin/Documents/Aaaa.docx /tmp
scp [email protected]:"C:/Users/admin/Documents/Aaaa.docx" /tmp 

you can skip default prefix C:

scp [email protected]:/Users/admin/Documents/Aaaa.docx /tmp


To copy a file from Linux to Windows, use the following command from Windows (no Windows SSH server required):

scp user@ip:/dir1/dir2/file "D:\dir1\dir2"

Assuming you have access to the windows machine, open a CMD and enter the following:

scp linuxUsername@ip_address_of_linux_machine:~/Documents/testFile.txt ./

This way you don't need to "send" anything to your windows machine, instead you can "grab" the file from your linux machine.

The ./ specifies your current windows directory - you can change this if you want to copy to a specific directory, see below:

(Using made up values for better real life example)

scp [email protected]:~/Documents/testFile.txt /C:/Users/Max/Documents

Step 1: Download pscp
(Based on your machine download the respective version)

Step 2: Get familiar with the pscp commands
To do so, open command prompt in your windows machine, go to directory where you have downloaded pscp.exe and type "pscp"

Step 3: Transfer file from your Linux machine to Windows machine
open your command prompt, and run below command providing your details:

pscp [email protected]:/path/of/your/File/nameofyourfile.txt ./

and this command will transfer the file from your Linux machine to the current directory of your windows machine

Step 4: Transfer file from your Windows machine to Linux machine
open your command prompt, and run below command providing your details:

pscp nameofyourfile.txt [email protected]:/path/where/youwantyourfile

I hope this is clear and works for you all!

  • 2
    Link only answers are rather unhelpful as they may stop working in the future - try to expand your answer by actually explaining the steps in the video. Commented May 30, 2017 at 13:58

Run this command to copy file from remote to local machine.

scp username@ip:path_of_the_file Destination_path

It will ask for credentials for the remote server.

  • What does your answer show that many of the existing answers do not show already? Commented Feb 16 at 9:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .