How to copy files from Linux to Windows using WinSCP
Posted on September 21st, 2022
There are two types of people who use the LINUX operating system. The first one are the employee of a multinational company who used the operating system because the company said so and the second type of people who use the LINUX operating system are people who just like using it because of its UI and security.
In the second scenario, what if you are using a virtual machine or an ec2 instance from any cloud platform and you had to download a specific file or folder from your LINUX operating system to your Windows operating system, then what would you do?
In this tutorial, we will learn how to use WinSCP Tool to download any file, folder or any kind of data from your Ubuntu Linux operating system to your Windows operating system.
Linux is very strict about users’ privacy and security and that’s why people like using Linux. It is very difficult to download a file or repository from LINUX operating system to your Windows operating system if you are not authorized or have less permission.
In this scenario, you can use the command line interface to give specific permissions and download what you need. But the process of doing all those things is very lengthy and complicated.
To make this process a bit simpler and faster there are multiple tools available with the help of which you can download any data from the Ubuntu or Redhat Linux Linux operating system to your Windows operating system.
Out of all those tools, WinSCP is quite a popular one to fulfill the purpose.
In this tutorial, we will learn how to install WinSCP to your Windows operating system and will follow all the steps which are required to download the data between these operating systems.
I will also provide you with a sample example and will perform the practical so that you could also follow the steps and download your desired file.
How To Download WinSCP on Windows Operating System
There are no commands needed to download WinSCP if you are using the Windows operating system.
Here is a link to download the WinSCP software on your Windows.
WinSCP Download Link – https://winscp.net/eng/download.php
Downloading WinSCP on your Windows is one thing and configuring it properly is another. Since you want to download data from Linux to your Windows, I am assuming that your LINUX operating system is running parallel with Windows OS.
Here are the steps to install WinSCP on Windows.
- Step 1 – Download the installer.
- Step 2 – Allow execution of the installer.
- Step 3 – Click on install for all users (recommended).
- Step 4 – Click on Next.
- Step 5 – Select “Commander” and click Next.
- Step 6 – Click on Install.
- Step 7 – Finish.
After installation, Open the WinSCP application to see a screen just like the following image.
In the above image, you can see the UI of WinSCP software. It is divided into two portions first and the left portion is your Windows side and the other portion which is the right side, is your LINUX operating system side.
Right now the right portion is blank because we have not configured the Linux operating system in the WinSCP.
WinSCP software uses the SCP command from behind. The SCP command is a CLI command and is a bit complicated. Therefore to make this process simpler we use a graphical way by using the WinSCP software.
So, this is my Ubuntu Linux operating system which has a text file by the name script stored in the directory home.
We will try to download this repository from the Linux operating system to the Windows operating system using WinSCP software.
Download Data From Linux Server To Windows
Before beginning the actual process we first need to add the username and password of Linux system in WinSCP. Here is how you do it.
After opening the WinSCP we have to first click on a new session.
A new pop-up box will appear and we have to fill whatever is asked in this pop-up box. We have to first mention the hostname of our Linux machine so, we can add a public IP of the Linux machine.
The port number is 22 which means that we are connecting to this machine with the help of ssh, so the firewall should have 22 port opened and your cloud instance should also have 22 port opened.
In the username section, we need to add the username of our machine. In my case since I have launched this machine with the help of AWS, I have a default ubuntu username set.
If your machine has a password you can directly mention it in the password section. But in my case, since I am using the AWS instance of Linux I have a PEM file as my password or authentication method for logging.
To enable SSH key based authentication, click on the “Advanced” option. Then go to the Authentication tab under SSH.
Here we have to submit our Private key. To generate a private key you can use will use putty software if you are using Windows. Once you have the location of the private key, select it.
After the key is set for authentication, we can log in to our Linux server. Once there, you will see two sections. The left part will show you the local files on your Windows machine. And in the right side, you will see all the files stored on the Linux server. In order to copy from one OS to another OS, all you need to do is drag and drop the files from one part to another. You can upload as well as download the files.
For example, I will copy the text file by the name of the script from the LINUX operating system right side to the Windows operating system which is on my left side.
As you can see I have copied the script text file from LINUX operating system to my Windows operating system. While you are downloading a file, you can select the location of the file on the local machine. By default, it will copy to the current directory on your local machine.
That is all. Using WinSCP, you can upload and download files to and form a remote server.