pscp scp ftp samba windows send files to linux
Open Windows power shell, then run pscp
PS C:\Users\xxx\Downloads> pscp test.tgz xxx@aa.bb.cc.18:/temp/
test.tgz | 48384 kB | 2304.0 kB/s | ETA: 00:12:22 | 2%
https://techgenix.com/data-transfer-between-linux-and-windows/
Copying data from one device to another is often considered an intimidating process. Transferring data from one operating system to another, such as from Windows to Linux or the other way, can be even more stressful. While the process of transferring data on cross-platforms such as in between Windows and Linux can be a little tricky, with the right tools and some accommodation, the process can be surprisingly easy.
While Windows is the go-to operating system for many, Linux is gaining traction and is being used by many across the globe for personal and professional use. Therefore, sharing files between these two can be crucial more often now. In this article, we are going to understand different ways of easily copying data between Linux and Windows.
Using SSH
Secure Shell (SSH) protocol is a method for secure remote login and file transfer. To use SSH for transferring data between Windows and Linux, we will first need an SSH client such as PuTTY. For the readers who do not have PuTTY installed on their computers, you can easily download, install, and set up PuTTY from putty.org for free. PuTTY comes with a terminal emulator for remote logins and also comes with tools like pscp (PuTTY secure copy client). PuTTY’s pscp allows users to securely copy files between Windows and Linux systems.
Users first need to download and install PuTTY pscp or other tools from here for the Windows and have an SSH-server setup and running on the Linux system. Also, note that port 22 needs to be open to allow the connections.
To install an SSH server, Debian based Linux systems such as Ubuntu can use these commands:
sudo apt update sudo apt install ssh-server sudo service ssh start
For Red Hat and other related Linux systems,
sudo yum install openssh-server sudo systemctl start sshd
With PuTTY’s pscp, moving files between Windows and Linux is straightforward. We need to give the path information of source and destination. You will also be needing the IP address of the Linux device, which can be found out using the ipconfig command. Here is the command structure to transfer data using pscp:
Path/to/pscp [options] [user@]host:source destination
For example, to copy a file called “file.txt” located in Windows to a tmp directory in Linux, use this command:
C:\Program Files\PuTTY>pscp \Users\user\file.txt user@192.168.0.18:/tmp
In the above command, 192.168.0.18 is a sample IP address of the Linux system. You will also be asked for the password to the Linux system after executing the above command. Once provided with a password, you will see the file being transferred along with other details such as the time it took to copy, transfer speeds, ETA, and transfer percentage.
To copy data from Linux to Windows, we just need to reverse the parameters.
C:\Program Files\PuTTY>pscp user@192.168.0.18:/tmp/file.txt \Users\user
Using FTP
Using File Transfer Protocol is one of the easiest ways of transferring files between Windows and Linux operating systems. To transfer data between Windows and Linux, we will be using SFTP (Secure File Transfer Protocol), which uses both SSH and FTP to transfer the data securely.
However, just like transferring data using SSH, SFTP also needs the Linux device to have the SSH server configured and running. Both the Windows and Linux operating systems need an FTP client like FileZilla installed, which supports SFTP.
To transfer data between Windows and Linux, simply open FileZilla on a Windows machine and follow the below steps:
- Navigate and open File > Site Manager.
- Click a New Site.
- Set the Protocol to SFTP (SSH File Transfer Protocol).
- Set the Hostname to the IP address of the Linux machine.
- Set the Logon Type as Normal.
- Add the username and password of the Linux machine .
- Click on connect.
Once connected, you can simply drag-and-drop all the necessary files between Linux and Windows machines.
Sharing network folders
Making a folder accessible over a network is the most straightforward approach to share files between Windows and Linux machines. However, this approach is fundamentally different from others. By creating shared network folders, we are mounting a Windows directory on Linux or a Linux directory on Windows over a network. Therefore, this approach will allow users to use the same files and folders in both Windows and Linux simultaneously.
Starting the setup with a Windows machine, users need to first edit the network connections. To do so, right-click on the network connection icon available on the systems tray.
Then select Open Network & Internet Settings, and click Sharing options and enable the following.
- Turn on network discovery.
- Turn on file and printer sharing.
Save the changes and navigate to the folder in the file system you wish to share over the network. Right-click on the folder and select Properties. Then open the Sharing tab and click on Advanced Sharing and select the Share this folder checkbox. You can also manage the permissions by clicking on the Permissions button on the same page. Once everything is done, apply, and save the settings.
To access this Windows directory on your Linux system, simply open the Linux system’s file browser and select Network. Now, navigate to the Windows-hosted folder, and you can start exchanging the data.
To share a folder from the Linux system to Windows, you will need a package or a tool that emulates the Windows protocols in a Linux machine allowing it to share and access data with a Windows machine. Samba is one such very widely used powerful tool that can allow users to mount any Linux folder on Windows and Windows folder on Linux.
Apart from these standard methods of transferring data between Linux and Windows OS, you can use any of the several third-party applications that allow you to transfer data between different machines running on different operating systems. However, all these third-party applications usually use any of the standard protocols such as SSH or FTP beneath to transfer the data.
Featured image: Shutterstock / TechGenix photo illustration