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]
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
As everything is set up now, I’ll cover two methods to copy and transfer files from Windows to Linux securely in this guide.
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
- 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
- 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.
➍ Open Files on your Ubuntu and go to home>nadiba>Desktop to check the copied file.
You 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.In 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:
Press OK and then click Login.
❸ Now, there will prompt a window asking ‘Continue connecting to an unknown server and add its host key to a cache?’. Click Yes.
➍ Then, put your user password again for authentication.
➎ 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.
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 |
|
|
Method 2 |
|
|
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
Related Articles
- How to Configure NFS Server in Linux? [5 Steps]
- How to Access Shared Folder in Ubuntu [2 Methods]
- How to Install and Configure Samba Server in Ubuntu? [4 Steps]
- How to Install, Configure and Connect Samba Client on Ubuntu
- Install, Configure and Connect Samba on Ubuntu Using GUI
- How to Access Samba Share from Windows [2 Methods]