Upload file to linux server from windows

3 different methods to upload file to Linux server from Windows. Using SCP or PSCP CLI tool, or Using WinSCP and/or FileZilla which are GUI based tool

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.

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.

ALSO READ: [SOLVED] Restrict FTP user to a directory in Linux

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:UsersfarukDownloads>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:UsersfarukDocuments>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.

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.

ALSO READ: How to transfer files over SSH with SSHFS in Linux & Windows

[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

ALSO READ: How to set SFTP umask in Linux? [100% Working]

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.

[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:

  • Download PSCP
  • Download WinSCP
  • Download Filezilla

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



27 Dec, 22



by Oliver K



3 min Read

How to transfer a file from windows to linux Server? [A Definitive Guide]

List of content you will read in this article:

  • 1. Steps to Transfer a File From Windows to Linux Server
  • 2. Conclusion

If you have a connected, working, and tested Linux Server and you are looking to transfer files from windows to a Linux server. You can do that; however, it is not as simple as you think. It is well known that working with servers, especially those running a command line interface, can be somewhat burdensome.

In this article, we will help you to upload local files from a Windows to a Linux VPS, whereas if you want to transfer data from a Windows pc to a Windows server, you can read this blog post.

Steps to Transfer a File From Windows to Linux Server

To understand the concept, The Windows PC you are transferring the files from will be referred to as the source, and the Linux Server you are transferring the files to will be referred to as the destination. For demonstration purposes, we have created a file on the desktop named “test.txt”.

Follow these simple steps to transfer files from a Windows to Linux server:

Step 1: Open “Run” by pressing the Windows key +R on your keyboard simultaneously or by typing run into the search bar.

Step 2: Type cmd in the open run window and press Enter.

Step 3: Enter the file’s directory by typing cd followed by the file path. (In this case, the file is on the desktop, so we write cd desktop).

Step 4: Use the “SCP” command in the same format as shown below to upload the file.

SCP filename.extension username@serveraddress:filepath

Where:

  • filename.extension: It is the name of the file and its extension (test.txt in our case)
  • username: It is the username used to connect to VPS (root in our case)
  • serveraddress: It is the IP address of the VPS or server
  • filepath: It is the path where you want the file to be copied to (/etc/ssh in our case)

Step 5: If this is your first time connecting to the server, Windows will ask you to accept the security alert. Please do so.

Step 6: Next, you will have to enter the destination server’s password.

And that’s it! Once the correct password has been entered, your file will be uploaded.

To verify that file is transferred, open putty and connect to the destination server. Use “Nano editor” or “vi” editor to open the file.

As can be seen in the following image, the file has been uploaded and is available on the server.

There is also a popular way to transfer files from windows to Linux server or vice versa with the help of WinSCP software. this is an alternate or easy solutions to complete your job.

Conclusion

Unfortunately, there is no simple way than WCP Software for drag-and-drop that we suggested above to upload/transfer files from a Windows VPS server to a Linux server. To be able to do or manage the virtual private server, you will need to learn how to use the command-line interface. Nevertheless, once you know how to do it, it is not much more complex than using your PC for your typical daily tasks. We hope that with the help of this article, you were able to help with the guideline that you are looking for. If you have any questions or suggestions, please leave them in the comment section listed below.

People Are Also Reading:

  • How to Secure Linux Server? [Linux Hardening]
  • How to Change Linux Password?
  • Centos/Debian/Ubuntu/Linux File Permissions
  • How to check Linux Version?
  • How to Create a Folder in Linux?
  • How to Find File in Linux?

How to Upload File to Linux Server from Windows

January 27, 2019
Linux, VPS Bits

It’s a fine day for another short and sweet tutorial. Today, you’ll learn how to copy a file from Windows to Linux using command line.

First off, do not be intimidated. This tutorial will only take you 5 minutes tops.

Transfer Files from Windows to Linux

There are various reasons why you may want to copy files from Windows to Linux. If you are like me, perhaps you have bought a Linux VPS and are trying to move your website files from the shared hosting account to the new account.

Here are the steps you should follow.

i) Download your website files from your shared hosting account and save them to your computer. I am assuming you are running a Windows PC.

ii) Download PSPC.exe (page download link) Note: make sure you choose the correct version for your computer i.e. 32-bit or 64-bit.

PSCP.exe does not need to be installed. It just runs outrightly on your machine.

iii) Copy the PSCP.exe file to your default System32 folder. In most cases, the folder is in the following path: C:WindowsSystem32

iv) Test whether the PSCP.exe can run. To do so, open your Command Line, (CMD.exe) and type pscp

If you see the following output, this means the program is running correctly.

How to Upload File to Linux Server from Windows 1

From here, you are ready to start the upload.

v) Upload your files by typing the following command on your Command console

pscp [PC path to file] [[email protected]]:[path to copy file]

Note: change the values in the parenthesis to your values. See the example below:

pscp C:UsersAdminDesktopwebsitefiles.zip  [email protected]:/home

The file we are uploading is the “websitefiles.zip”

The login credentials for our Linux server are

[email protected]

The path where we would like to copy the files is ‘/home’

When you press Enter on your command console, you will be prompted to enter your Linux server password.

Copy Files from Linux to Windows Desktop

You can also copy file from your Linux server back to your Windows machine. To do this, we simply need to interchange the command to

pscp [[email protected]]:[path to copy file]  [PC path to file]

In our above example, we would have:

pscp [email protected]:/home/websitefiles.zip   C:UsersAdminDesktop

NOTES

i) If you get the error: pscp not a regular file when trying to upload your files, you will have to copy the file recursively. In this case, use the following command:

pscp -r [email protected]:/home/websitefiles.zip  C:UsersAdminDesktop

ii) If you get the error: permission denied when executing the pscp command, make sure you are logging into your server as the root user.

There we have it. Let me know if this works for you.

If I helped you, please share the article and consider buying me coffee through the link below:

About The Author

I Cozens

I’m using Windows. I want to upload a file to Amazon server using putty from my Windows system.

  • How to do this using scp or any other command?
  • How do I download a file from the Amazon server to my Windows system?

polym's user avatar

polym

10.5k9 gold badges39 silver badges65 bronze badges

asked Jul 1, 2014 at 7:22

user3676417's user avatar

2

I would recommend a full terminal emulator for Windows like Cygwin, MobaXterm, or BitVise. Cygwin will let you SSH and SCP from the command line. MobaXterm has a built in file transfer pane that will follow the command line’s working directory. Like Moba, BitVise offers a terminal and a graphical interface for moving files to and from the remote system. Following is a picture of the BitVise SFTP interface.

BitVise SFTP interface

answered Jul 1, 2014 at 15:57

Michael J's user avatar

Michael JMichael J

5434 silver badges9 bronze badges

Putty is a terminal client providing you a way to execute commands and view their output on the remote machine. It is not a file transfer client. There is an SCP program in the same family of tools for Windows called PSCP, but it is command line focused for use in a windows console and might not be the easiest place to get started.

Instead I would recommend checking out WinSCP, a graphical client for SCP operations with a two-pane interface for transferring files back and forth that is likely the sort of thing you are looking for. Like all SCP programs it uses the SSH protocol for authentication and over the wire security but is focused on just the file copy operations provided by SCP.

answered Jul 1, 2014 at 7:27

Caleb's user avatar

CalebCaleb

67.8k16 gold badges196 silver badges224 bronze badges

4

Putty in itself doesn’t support file transfers in the way that you want. You would need to download, install and use PSCP and PSFTP (from PuTTY).

There are other clients too such as WinSCP, Filezilla which may suit your needs better.

answered Jul 1, 2014 at 7:29

Warwick's user avatar

WarwickWarwick

1,62012 silver badges16 bronze badges

3

Copying data from a Windows PC to Linux—or in the other direction—can seem intimidating at first. After all, it’s something that seems like it should be simple but turns out to be difficult.

In truth, sharing files from Windows to Linux is easy, but only if you know how to do it. Ready to find out? Here’s everything you need to know about how to transfer files from Windows to Linux and back again.

4 Ways to Transfer Files From Windows to Linux

If you want to move data between Windows and Linux operating systems, it’s easier than you think. We’ve compiled four ways for you to do this:

  1. Securely copy files via SSH
  2. Windows to Linux file transfer with FTP
  3. Share data using sync software
  4. Use shared folders in your Linux virtual machine

With each of these methods, you’ll be able to easily (and, in some cases, effortlessly) carry out Linux to Windows or Windows to Linux file transfer.

Let’s look at them in turn and find out which one suits you best.

1. Copy Files Between Windows and Linux via SSH

With SSH enabled on your Linux device, you can send data via the command line from one computer to another. For this to work, however, you will need to set up an SSH server on your Linux machine.

Start by opening a terminal and updating and upgrading the OS.

 sudo apt update
sudo apt upgrade

Once complete, install the SSH server. The OpenSSH server is a good option.

 sudo apt install openssh-server 

Wait while it installs. To check at any time if the OpenSSH server is running, use:

 sudo service ssh status 

To transfer data from Windows, use an SSH client like PuTTY. This needs the PSCP (secure copy client) tool to download to your Windows system to run alongside PuTTY. Find both on the PuTTY downloads page.

Download: PuTTY

Note that while PuTTY will need installing, PSCP won’t. Instead, save the downloaded pscp.exe file in the root of the Windows C: drive or else set it up as an environment variable. You’ll also need to confirm the IP address of the Linux device. Check in the Linux terminal with:

 hostname -I 

With a connection established, you can transfer a file from Windows to Linux like this:

 c:pscp c:somepathtoafile.txt user@remoteIP:homeusersomepathnewname.txt 

You’ll be prompted for your password for the Linux computer before the transfer commences.

Want to copy files from Linux to Windows in the same SSH session? This command will download the specified file to the current directory:

 c:pscp user@remoteIP:homeusersomefile.txt . 

Note the lone period at the end, which you must include, or the transfer will not work.

2. How to Transfer Files From Linux to Windows Using FTP

You can also use a file transfer protocol (FTP) application with SSH support. Transferring files via SFTP in a mouse-driven user interface is arguably easier than relying on typed commands.

Again, an SSH server must be running on the Linux machine before you start. You should also ensure you have installed an FTP app on Windows, like FileZilla, which has SFTP support.

Download: FileZilla

To use this method, run FileZilla, then:

  1. Open File > Site Manager
  2. Create a New Site
  3. Set the Protocol to SFTP
  4. Add the target IP address in Host
  5. Specify a username and password
  6. Set the Logon Type to Normal
  7. Click Connect when ready
Share files between Linux and Windows using FTP

You can then use the FTP app to move files from Windows to Linux and back using drag and drop.

Another option you should consider is a file-syncing program. These are typically cross-platform and use an encrypted key to manage the connection between devices.

All you need to do is install the app, nominate a sync folder, then create the key. Set this up on the second PC, and your data will then sync. Two good options are available for this:

  1. Resilio Sync: Formerly known as BitTorrent Sync, Resilio is available on almost any platform you can think of. There is a paid version, but the free option is enough for syncing two devices
  2. Syncthing: For Linux, Windows, macOS, and Android, this Resilio Sync alternative offers a similar feature without the paid component

4. How to Transfer Files From Windows to a Linux Virtual Machine

Instead of running a separate PC, it’s common to run Linux or Windows in a virtual machine (VM). But is there a way to transfer files between Windows and Linux when one is installed in a VM?

Fortunately, yes. With VirtualBox, you can create a virtual shared directory for data syncing.

If you’re running Windows in a VM on Linux (or vice versa), VirtualBox is already set up for sharing. Ensure you have the Guest Additions installed on your virtual machine before proceeding.

In the VirtualBox manager, select the VM, then:

  1. Choose Start > Headless Start (or with the VM running, Devices > Shared Folders)
    Enable a headless start for your VM
  2. Once running, right-click the VM and select Settings > Shared Folders
  3. Select Machine Folders
  4. Click the + symbol on the right (or right-click and select Add Shared Folder)
  5. Browse the Folder Path and find the directory you want to use
  6. Set a name (if necessary), then OK
    Share files between Windows and Linux in a virtual machine
  7. Use the Auto-mount checkbox to ensure the share is available whenever the VM runs
  8. Click OK again to confirm and exit

When you reboot the VM, the share will be ready to swap data between the host PC and the guest operating system.

There is another option for sharing files between Windows and Linux PCs. However, creating a shared file on one or both systems and then accessing it across a network is unreliable at best.

Sharing Files Between Windows and Linux Is Easy

Whether you’re new to Linux or you find Windows unfamiliar, sharing data between them is easier than you think. Now that you know how to transfer files from Windows to Linux and vice versa, we’d recommend you try all the methods we’ve mentioned above and work out which one you’re most comfortable with.

If you’re syncing data to Linux, there’s a good chance you’re switching from Windows. Don’t worry—it’s easier than you think.

Понравилась статья? Поделить с друзьями:
  • Uplay скачать для windows 10 x64 бесплатно с официального сайта
  • Uplay не работает на windows 7
  • Uplay не запускается на windows 10
  • Uplay r164 dll far cry 4 windows 10
  • Uplay r1 dll скачать для windows 10