[SOLVED] Upload file to Linux server from Windows

There are multiple methods of uploading files from Windows server to Linux server. It can be done both from the Windows command line and with applications with a graphical interface. Let's take a look at "How to upload a file to Linux server from Windows".

 

How to safely upload file to Linux server from Windows?

To copy files between two servers, they must be on the same network. SCP (Secure Copy) and SFTP(Secure FTP) are used for installation. File transfer is encrypted and secure as SCP and SFTP use SSH. SCP(Secure Copy) and SFTP(Secure FTP) are used for upload. The applications we will give examples below are SSH clients.

Advertisement

 

Pre-requisites

  • The Windows is reachable to the Linux Server. If the Linux is on your VirtualBox then you can use Bridged Networking or NAT with Port Forwarding to be on the same network as Windows.
  • SSHD service MUST be in running state as the file transfer will happen over OpenSSH protocol. You may also choose to setup vsftpd to use dedicated FTP server for file transfer but that is optional.
  • Firewall on the Linux server must be accepting traffic on Port 22 (default SSHD port) or the port used by Linux server. Execute netstat -ntlp | grep ssh on the Linux server to get this information.

 

Method-1: Upload with SCP and PSCP using CLI CMD

Press the Windows key and type cmd and open the command line.

SCP command usage : scp example_file target_user@ip_address:/target_file_path

C:\Users\faruk\Downloads>scp Get_Started_With_Smallpdf.pdf foc@192.168.122.177:/tmp
foc@192.168.122.177's password:
Get_Started_With_Smallpdf.pdf 100% 68KB 67.8KB/s 00:00

The file is uploaded successfully with the SCP command.

PSCP command usage:    pscp example_file target_user@ip_address:/target_file_path

C:\Users\faruk\Documents>pscp sample.pdf foc@192.168.122.118:/tmp
foc@192.168.122.118's password:
sample.pdf | 2 kB | 3.0 kB/s | ETA: 00:00:00 | 100%

The sample.pdf file has been successfully uploaded to the target linux server.

 

Method-2: Using WinSCP

You can download winscp if it is not installed on your Windows server. It is a free software for download. File upload can be done with both SFTP and SCP in WinSCP.

Advertisement

 

Using SFTP Protocol

Fill the following fields:

  • File Protocol: SFTP (to perform file transfer securely)
  • Host Name: Linux server IP
  • Port Number: In most cases it is 22 but if you are using a different port number for OpenSSH then connect to Linux server and execute netstat -ntlp | grep ssh to get the port number used by SSHD process
  • User name: Provide the username from Linux server using which you want to connect
  • Password: Password of the respective user

Click on Login to continue.

[SOLVED] Upload file to Linux server from Windows

 

Windows (Left) and target Linux server (Right) directories are listed. You can change the destination directory of your source and destination accordingly on LEFT or RIGHT side. Next to upload the file you can just drag it to the destination location. Don't worry it will NOT move the file and instead it will just copy the file to destination Linux server.

[SOLVED] Upload file to Linux server from Windows

 

The selected file has been successfully uploaded to the Linux server.

[SOLVED] Upload file to Linux server from Windows

 

Using SCP Protocol

You can also upload by choosing SCP as the protocol in WinSCP.

Fill the following fields:

  • File Protocol: SCP (to perform file transfer securely)
  • Host Name: Linux server IP
  • Port Number: In most cases it is 22 but if you are using a different port number for OpenSSH then connect to Linux server and execute netstat -ntlp | grep ssh to get the port number used by SSHD process
  • User name: Provide the username from Linux server using which you want to connect
  • Password: Password of the respective user

[SOLVED] Upload file to Linux server from Windows

 

Now you can change your source and destination directory in the WinScp. Next drag the files or directory from LEFT side to the RIGHT side for the upload.

[SOLVED] Upload file to Linux server from Windows

Uploading with SCP was completed successfully.

 

Method-3: Using Filezilla

FileZilla is another freely available software for windows which we use to upload files to Linux server. You can download FileZilla based on your Windows environment. Fill in the below details:

  • Host: Target Linux server IP
  • Port Number: In most cases it is 22 but if you are using a different port number for OpenSSH then connect to Linux server and execute netstat -ntlp | grep ssh to get the port number used by SSHD process
  • User name: Provide the username from Linux server using which you want to connect
  • Password: Password of the respective user

Then click the Quickconnect button:

[SOLVED] Upload file to Linux server from Windows

 

Windows server directories are listed on the left, and target Linux server directories are listed on the right. The file to be uploaded to the Linux server is selected from the left screen and right clicked. Then click Upload and the file is sent to the Linux server.

[SOLVED] Upload file to Linux server from Windows

 

You can also do the same by dragging the file to the right screen.  A notification is displayed when the file upload is complete.

Advertisement

[SOLVED] Upload file to Linux server from Windows

You can upload one or more files this way.

 

Summary

We have explained the most used methods to upload files from Windows to Linux server. You can use different methods by researching it yourself. Finally, you should pay attention to the fact that the user to copy should exist on the target server and the directory she is authorized should be selected as the target directory.  Otherwise, you will have access and authorization problems.

You can find the download link of the applications we used above below:

 

References

stackoverflow.com - How to upload a file from Windows machine to Linux machine using command lines via PuTTy?

 

Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment

X