How to share and transfer files between Linux and Windows

File sharing between Windows and Linux connected over a local network can be done in several ways. This tutorial mentions the most common methods that use simple techniques.

Previously we have shown you how to remotely connect to your Linux machine from a Windows one (Click here). Now, what if you need to transfer some files between your Windows and Linux systems?

Well, a USB drive comes handy for simple data transfers. For a large number of files at different times, you need another efficient method. Transferring your data between Linux and Windows using your local network is the recommended option. With an easy and quick one time setup, you can share your files between various machines.

File Sharing between Linux and Windows Systems

In this tutorial, we shall walk you through sharing your files between Ubuntu and Windows machines over a local network.

Transferring files between Ubuntu and Windows can be done in many ways, but in this tutorial, we are going to discuss the following popular methods:

  1. Transfer files between Ubuntu and Windows via the SSH.
  2. Transfer files between Ubuntu and Windows using Samba.
  3. Transfer files between Ubuntu and Windows using Shared Network Folders.

Method 1: Transfer Files Between Ubuntu And Windows Via SSH

In this method, you need to install and enable SSH service on Ubuntu. Also, we need an SSH client application on Windows. In this tutorial, we shall be using Putty. Next, we are going to use the command line to share your files across the network.

Step 1. Install the SSH package on Ubuntu using the next command.

sudo apt install openssh-server

Install The Open SSH Package On Ubuntu
Install The Open SSH Package On Ubuntu

Step 2. After installation finishes successfully, you can check the SSH service status using the following command.

sudo service ssh status

The output of the command should look like the below screenshot:

Check The SSH Service Status
Check The SSH Service Status

If the service is not running, you can use the following command to start it:

sudo service ssh start

Also, to enable the SSH service to start every time your system starts up, you can use the following command:

sudo service ssh enable

Step 3. Install the net-tools package.

sudo apt install net-tools

Install net-tools Package
Install net-tools Package

Step 4. Execute the next command to get your Ubuntu machine IP.

ifconfig

Ubuntu Machine IP
Ubuntu Machine IP

Step 5. From your Windows machine, we need an SSH client (which is Putty) and a PSCP. PSCP is considered a secure copy tool that is used alongside with Putty to transfer files securely over a network.

You can download both (Putty and PSCP) from Putty official website. (Click here.) Kindly note that Putty will need to be installed while the PSCP won’t. You have to put the PSCP.exe in the “C:\” drive to be used as you should see shortly.

Step 6. Now open the file explorer and use the next command to start transferring your files from your Windows machine to Ubuntu.

c:\pscp "C:\Ubuntu Tutorials\Windows Shared Folder\Windows Shared Folder.txt" hendadel@192.168.1.8:windowssharedfile.txt

Copy File From Windows To Ubuntu Via SSH
Copy File From Windows To Ubuntu Via SSH

Step 7. Next, you should enter your Ubuntu password.

Enter Your Ubuntu Password
Enter Your Ubuntu Password

Step 8. After entering the password successfully, the command shall copy the text file from your Windows machine to your Ubuntu home. You can check your home directory now, and you should find the file there.

Check The Copied File
Check The Copied File

Step 9. Now in case you need to transfer your files from Ubuntu machine to Windows, open the file explorer from your Windows machine and use the next command. Be careful and do not forget the dot at the end of the command.

c:\pscp hendadel@192.168.1.8:ubuntushared .

Copy File From Ubuntu To Windows Via SSH
Copy File From Ubuntu To Windows Via SSH

By executing the previous command, you should enter the password of your Ubuntu machine. Next, the file gets transferred from Ubuntu to the Windows current directory.

File Copied Successfully
File Copied Successfully

Method 2: Transfer Files Via Samba

In this method, we are going to install the Samba package on Ubuntu. Moreover, use the Windows run application to connect to the Ubuntu shared directories.

Step 1. Install the Samba package on Ubuntu using the following command.

sudo apt install samba

Install Samba Package On Ubuntu
Install Samba Package On Ubuntu

Step 2. You can set a password to the samba share as follows.

sudo smbpasswd -a hendadel

Add A User For Samba Share
Add A User For Samba Share

where hendadel is an Ubuntu user that you shall use while accessing the Ubuntu shared directory.

Step 3. Let’s create a directory that is used for sharing your files.

mkdir /home/hendadel/UbuntuSharedDir

Create Directory For The Shared Data
Create Directory For The Shared Data

Step 4. Using your favorite text editor, open the samba configuration file.

sudo vi /etc/samba/smb.conf

Open Samba Configuration File
Open Samba Configuration File

Step 5. Add the next lines at the end of the samba configuration file.

[UbuntuSharedDir]
path = /home/hendadel/UbuntuSharedDir
available = yes
valid users = hendadel
read only = no
browsable = yes
public = yes
writable = yes

The samba configuration file should like the below:

Edit Samba Configuration File
Edit Samba Configuration File

Save and exit the samba configuration file.

Step 6. Restart the samba service using the following command:

sudo service smbd restart

Restart Samba Service
Restart Samba Service

Step 7. From the Windows machine, open the run application from the Start menu and enter the Ubuntu machine IP with the shared directory name as follows.

\192.168.1.8\UbuntuSharedDir

Remote Access To Your Ubuntu
Remote Access To Your Ubuntu

Press the OK button to continue.

Step 8. A Windows Security message will appear, you should have to enter your samba username and password. Then press the OK button to continue.

Authentication Required
Authentication Required

Step 9. Now you should have access to your Ubuntu shared directory, and you can transfer files.

Welcome To Your Ubuntu Shared Directory
Welcome To Your Ubuntu Shared Directory

 

Method 3: Shared Network Folders

This is the easiest method among all. In this method, we share any folder from the Windows machine to be visible in the Ubuntu machine.

Step 1. From the Windows machine, right-click on the network connections icon in the right bottom of the taskbar.

Right Click On Network Connections
Right Click On Network Connections

Step 2. Choose the “Open Network & Internet Settings.”

Open Network and Internet Settings.
Open Network and Internet Settings.

Step 3. Next, choose “Sharing Options.”

Open Sharing Options
Open Sharing Options

Step 4. Now from your current network profile, choose the following options:

  • Turn on network discovery.
  • Turn on file and printer sharing.

Choose Options And Save Changes
Choose Options And Save Changes

Don’t forget to save your changes.

Step 5. Now open your file explorer and go to the directory that you need to share. Right-click on the folder then select Properties.

Open Folder Properties
Open Folder Properties

Step 6. After opening the folder properties, let’s choose the Sharing tab. Also, select the Advanced Sharing button.

Open Advanced Sharing
Open Advanced Sharing

Step 7. Mark “Share this folder” box.

Check The Share This Folder
Check The Share This Folder

In case you need to set permissions on the shared folder like (Read, Write) you can select the permissions button and set your permissions.

Set Sharing Permissions
Set Sharing Permissions

Press the OK button to continue.

Step 8. Now from the Ubuntu machine, open the file browser.

From Your Ubuntu Open The File Browser
From Your Ubuntu Open The File Browser

Step 9. From the left panel, choose “Other Locations.”

 

Open Other Locations
Open Other Locations

Step 10. In the bottom bar, enter your Windows machine IP and path to the shared folder as follows:

smb://192.168.1.6/Windows Shared Folder

Connect To Windows Shared Folder
Connect To Windows Shared Folder

Then press the Connect button.

Step 11. An authentication message should appear. Enter your username and password. Press the Connect button to continue.

Enter Your Windows Machine Username And Password
Enter Your Windows Machine Username And Password

Step 12. Next, you should be able to see your Windows shared folder. Now you can transfer files between the two machines.

Welcome To Your Windows Shared Folder
Welcome To Your Windows Shared Folder

That’s it for now about various methods that can be used for transferring files between Windows and Linux.

Hend Adel
Hi! I'm Hend Adel, a freelancer technical geek with successful experience in Database, Linux and many other IT fields. I help to build solutions to suit business needs and creating streamlined processes. I love Linux and I'm here to share my skills via FOSS Linux! Thanks for reading my article.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

24,437FansLike
181FollowersFollow

LATEST ARTICLES

How to create Manjaro Linux Live USB drive in Windows PC

Create Manjaro Live USB flash drive
Manjaro Linux is based on the independently developed Arch operating system.  Arch Linux is already known to be an exceptionally fast, powerful, and lightweight distribution. But Arch Linux is typically targeted to geeks who have some Linux background and command-line usage.

RECENT COMMENTS

Free up hard disk space ubuntu
Hard disk space can easily get filled up with cached package files, old kernels, and other obsolete files that occupy unwanted hard disk space. Here are top five best and safer ways to clean and free up hard disk space in Ubuntu. We show you Terminal and GUI way of cleaning up system.
screen capture apps linux
Do you want to make a video tutorial for YouTube or show-off your epic victory royale to your friends? Look no further — as we have compiled the 10 Best Screen Capturing Software for Linux. Whether you need to record your desktop screen or take a simple screenshot, FOSSLinux has got your back.
Ubuntu 19.10 beta overview
It may be early, but I've been looking forward to the release of Ubuntu 19.10 for some time now. As an impatient person, and promised readers in the FOSSLinux article announcing the release of Eoan Ermine that we would provide you a review of Ubuntu 19.10 Eoan Ermine - Beta.  So, here it goes.