How to Copy File from Windows to Linux Using SSH [2 Methods]

Want to copy and transfer files and folders securely from Windows to Linux using SSH? SCP (Secure Copy) can be the finest tool in this case. It actually works within SSH (Secure Shell) protocol and demonstrates a secure and high-speed data transfer from one computer to another over an unsecured network. In this guide, I will describe how to copy file from Windows to Linux over SSH using the SCP tool on Windows 10. Explore and follow the guide manually.

Key Takeaways

  • Learning about SSH protocol.
  • Learning how to copy files from Windows to Linux using PowerShell and SCP/SSH.

Requirements

  • Users must have Windows 10 setup.
  • Users’ Linux PC must be running an OpenSSH server.

Process Flow Chart

[Distro & Windows Used Throughout the Tutorial: Ubuntu 22.04.2 LTS & Windows 10]Flowchart on copying files from Windows to Linux using SSH

Downloads

To download WinSCP for file transfer follow the link: Winscp.net

2 Methods to Copy File from Windows to Linux Using SSH

If you want to make the SCP tool work on your Windows, there must be a running OpenSSH server on your Linux system to where you want to transfer files and folders. Here is how to get the SSH server installed:

sudo apt install openssh-server
EXPLANATION
  • sudo: Super User DO.
  • apt install: Advanced package utility.
  • openssh-server: Open source secure shell server permits remote users to access server.

Installing SSH serverAs everything is set up now, I’ll cover two methods to copy and transfer files from Windows to Linux securely in this guide.

You can go through the Comparative Analysis of Methods to know about the pros and cons of the used methods.

Method 01: Using PowerShell to Copy File from Windows to Linux Using SSH

By default, SCP is built into Windows 10 PowerShell. You don’t have to install it separately. You can use SCP in PowerShell directly by following the steps below:

Steps to Follow >

❶ Open Windows File explorer and copy the file location you want to copy from Windows to Linux.

➋ Now, open PowerShell and write cd and paste the copied file location like below and hit ENTER.

cd C:\Users\User\Downloads
EXPLANATION
  • cd: Navigates to assigned folder.
  • C:\Users\User\Downloads: The location of the file/folder.

➌ Then, use the SCP command like the following syntax:

SCP colors.txt [email protected]:/home/nadiba/Desktop
EXPLANATION
  • SCP: It allows secure file transfer between the hosts on a network.
  • colors.txt: The file you want to transfer. Here, I want to transfer the ‘colors.txt’ file.
  • [email protected]:/home/nadiba/Desktop: Replace ‘nadiba’ with your Linux username, replace ‘192.168.231.128’ with your LAN IP address or hostname, replace ‘/home/nadiba/Desktop’ with the folder where you want to transfer the file.

Writing command and copying file from PowerShell➍ Open Files on your Ubuntu and go to home>nadiba>Desktop to check the copied file.Opening the transferred file on Ubuntu to checkYou can see from the above image that the file ‘colors.txt’ has been transferred to the Linux system.

Read More: How to Share Files between Linux and Windows

Method 02: Using SFTP Client to Copy File from Windows to Linux Using SSH

For Windows, there are several SFTP clients available like WinSCP, FileZilla, Cyberduck, PuTTY etc. Among them, WinSCP can be a better option to transfer files from Windows to Linux when you want to avoid syntax complexity. It provides a convenient GUI interface. Here’s how to use WinSCP to copy files:

Steps to Follow >

❶ Download and install WinSCP on your PC. You will find the download link above in the Downloads section.

❷ Now, launch it and you will see a Login window.Entering file protocol, hostname, name, user-password in login windowIn the File protocol section, replace SFTP with SCP. Also, enter the hostname, username, password and click Save. Then, there will prompt a new window like the following image:Saving the entered inputsPress OK and then click Login.Clicking on 'Login' to proceed❸ Now, there will prompt a window asking ‘Continue connecting to an unknown server and add its host key to a cache?’. Click Yes.Clicking 'Yes' to the prompted window ‘Continue connecting to an unknown server and add its host key to a cache?’➍ Then, put your user password again for authentication.Authenticating by putting password again➎ Open File explorer on Windows, browse a file and drag the file into WinSCP’s window. The file will be shared instantly to the remote Linux PC. Selecting file in Windows to copy

Dragging & transferring file to Linux Here, I want to share an image file named ‘samba.png’. So, I dragged it into the WinSCP window and you can see that the file is transferred to Linux.

Read More: How to Share Files between Linux and Windows Dual Boot [3 Methods]

Comparative Analysis of Methods 

When it comes to copying files from Windows to Linux over SSH, you can use either PowerShell or SFTP client. Let’s make a comparative analysis between these two methods:

Methods Pros Cons
Method 1
  • SSH supported.
  • Flexibility.
  • Error-handling, logging capability.
  • Syntax complexity.
  • Limited custom options.
Method 2
  • User-friendly interface.
  • No syntax complexity.
  • Supports multiple file transfer protocols.
  • Less integration.
  • Limited features.

Overall, both methods are preferable with their individual capabilities. It’s your choice to select one which meets up your needs and preferences.

Conclusion

While working on Windows, transferring files to Linux machines is quite a common task. In the article, I have introduced different methods to copy files from Windows to Linux through SSH protocol. Hope you’ll be benefited from this guide.

People Also Ask

Does SCP work on Windows?
Yes, you can run SCP via PuTTY (An open source terminal emulator which provides secure connection).
Does PowerShell have SCP?
PowerShell does not have SCP by default. Check ‘Enable Secure Copy Protocol Support’ on the connection tab. Then, click Save Changes and restart.
Does SCP work on Internet?
Using SCP requires only a  running ssh server and client SCP on the internet works fine.
Does SCP have a limit?
SCP’s policy document;’s maximum size is 5120 bytes.

Related Articles 

Rate this post
Nadiba Rahman

Hello, This is Nadiba Rahman, currently working as a Linux Content Developer Executive at SOFTEKO. I have completed my graduation with a bachelor’s degree in Electronics & Telecommunication Engineering from Rajshahi University of Engineering & Technology (RUET).I am quite passionate about crafting. I really adore exploring and learning new things which always helps me to think transparently. And this curiosity led me to pursue knowledge about Linux. My goal is to portray Linux-based practical problems and share them with you. Read Full Bio

Leave a Comment