Home / Exciting tips / Linux / How to transfer files to Linux from Windows 10 over SSH

How to transfer files to Linux from Windows 10 over SSH

The fastest way to transfer files and folders over SSH from Windows 10 to Linux is with the SCP tool. It works within the SSH protocol and allows users to quickly and easily transfer data right over the command-line from one computer to another!

In this guide, we’ll show you how to use SCP on your Windows 10. We’ll cover two methods. The first method is using the Windows PowerShell, Microsoft’s equivalent to the Linux command-line. The second method we will cover is WinSCP, a utility that allows Windows users to transfer files using SCP over SSH with a nice GUI.

Note: for SCP to work on Windows 10, the Linux PC you plan to transfer files to must already be running an OpenSSH server. To set up an SSH server on your Linux system, please follow our guide on the subject!

Method 1 – PowerShell

Windows PowerShell is arguably the best way to use SCP on Windows 10. The reason? Windows 10 users all already have access to PowerShell, and there’s no need to configure or tweak anything to use it. Better still, Microsoft has SCP built into PowerShell, so Windows 10 users don’t even have to install it!

To use SCP in PowerShell, start by launching the PowerShell console on your Windows 10 desktop. To do that, press Win on the keyboard, search for “PowerShell” and launch the app with the blue terminal icon. Then, follow the step-by-step instructions below to learn how to SCP files and folders to your Linux box.

Step 1: Open up Windows Explorer and navigate to the location of the file/folder you wish to transfer to the Linux system. So, for example, if there were a file or folder in “Documents,” the location would be C:\Users\EXAMPLE_USERNAME\Documents\.  Then, copy the location data to your clipboard using Ctrl + C.

Step 2: Go back to the PowerShell window, and write cd into the command prompt. Then, after writing cd, right-click with the mouse. By right-clicking, you will paste the location you copied to the clipboard.

Once the location is pasted in the PowerShell prompt, it should look like the following command.

cd C:\Some\location\of\files\or\folders\to\transfer\

Press the Enter key to execute the command.

Step 3: After executing the cd command, PowerShell will be in the directory where the files are that you want to transfer. From here, go back to Windows Explorer and look through this same directory for files/folders you want to transfer.

For example, if you wish to transfer example-photo.png to your Linux PC, take note of the filename. Or, if you’d like to transfer a directory, say, “Important-Files“, remember the folder name.

Step 4: In PowerShell, use the SCP command to transfer a file or directory over SSH to your Linux PC.

Note: when attempting to transfer files or folders, PowerShell may say, “The authenticity of host can’t be established. Are you sure you want to continue connecting?” You must select “yes,” or SCP will fail.

Transfer a file

To transfer a file over SCP from Windows 10 to a Linux PC over SSH, customize the command below. Note that you must change example-photo.png to the actual file you wish to transfer, remote_linux_username to the username on the Linux PC, linux_hostname_or_local_ip to the Linux PC’s hostname/LAN IP address, and /remote/directory/on/linux/pc to a real directory on the Linux PC.

scp example-photo.png remote_linux_username@linux_hostname_or_local_ip:/remote/directory/on/linux/pc

Transfer the contents of a directory

Need to transfer the contents of an entire folder? Make use of scp -r. Remember to change C:\Users\EXAMPLE_USERNAME\Documents\Important-Files to the actual file folder on your Windows 10 PC, remote_linux_username to the username on the Linux PC, linux_hostname_or_local_ip to the Linux PC’s hostname/LAN IP address, and /remote/directory/on/linux/pc to an actual directory on the Linux PC.

scp -r 'C:\Users\EXAMPLE_USERNAME\Documents\Important-Files' remote_linux_username@linux_hostname_or_local_ip:/remote/directory/on/linux/pc

Method 2 – WinSCP

If you’re not a huge fan of the command-line but still need to transfer files from Windows 10 to a remote Linux system via SSH, you can use WinSCP. It adds on a beautiful GUI on top of SCP (it also supports other protocols). Here’s how to use it to transfer files and folders.

Step 1: Download and install the WinSCP application on your Windows 10 PC. To download the app, head over to winscp.net, and click on the green “DOWNLOAD NOW” button. Once the installer is done, launch it and install the program on your Windows 10 PC.

Step 2: After WinSCP is installed, launch it on your Windows 10 desktop. Upon launching, you will see a “Login” window. In the login window, look for “File protocol” and change it from “SFTP” to “SCP.”

Step 3: Find “Host name” and write out the hostname of the Linux PC. Can’t figure out the hostname? The LAN IP address also works.

Step 4: Find the “User name” text-box, and write in the name of the user on the remote Linux PC in the box.

Step 5: Find the “Password” box and write in the name of the password to the remote Linux PC. Then, click “Save” to save the information.

Step 6: Select the “Login” button to access your remote Linux PC over SCP/SSH. While logging in, be sure to select “Yes” when WinSCP asks, “Continue connecting to an unknown server and add its host key to a cache?”

Step 7: Open up the Windows Explorer and browse for the file or folder you wish to share over SCP/SSH protocol. Then, drag it into the WinSCP window. It will instantly transfer to the remote Linux PC using SCP!

About excitingtips

Check Also

How to install the Pinta image editor on Linux

Pinta is a free, open program for photo editing and drawing. It is cross-platform and …

Leave a Reply

Your email address will not be published. Required fields are marked *