How to copy files from Linux to Windows using WinSCP
To copy files from a Linux machine to a Windows machine using WinSCP, follow these steps:
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.
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, We assume that your LINUX operating system is running parallel with Windows OS.
Here are the steps to install WinSCP on Windows.
- Download the installer.
- Allow execution of the installer.
- Click on install for all users (recommended).
- Click on Next.
- Select “Commander” and click Next.
- Click on Install.
- 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: the left portion is your Windows side and the other portion, on the right, is your LINUX operating system side.
Right now, the right portion is blank because we have not configured the Linux operating system in 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 named "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 the Linux system in WinSCP. Here is how you do it.
After opening WinSCP, we have to first click on a new session.
A new pop-up box will appear, and we have to fill in 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 port 22 opened, and your node should also have port 22 opened.
In the username section, we need to add the username of our machine.
If your machine has a password, you can directly mention it in the password section. But in my case, since we are using the E2E node of Linux, we have a PEM file as my password or authentication method for logging in.
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 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 on 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, we will copy the text file by the name of the "script" from the LINUX operating system (right side) to the Windows operating system (left side).
As you can see, we have copied the script text file from the 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 from a remote server.