[Solved] How To Share Files Between Ubuntu And Windows 


Before you get into this article, let's read a short description of why?

Everything you do in Linux is fine, imagine you are a windows user like to copy files from your windows to Linux - What might be your first thought to do? 

step by step guide in  Watch here

Here are the different ways you can copy files from Windows to Linux.

1. Using shared folders in your Linux virtual machine 

2. Share data using sync software

3. Securely copy files via SSH 

4. Transfer files with FTP 

5. Share network folders

Before continue all the 5 options provided, isn't hard to remember everything at a stretch?

So let's explore only the first option "Using share folders in Linux Virtual Machine

Since this article related to Linux Ubuntu - here is Linux command line solution 

Transfer file from Windows to Linux







Introduction

As you work in Linux or windows either way you may have to transfer files from one another. In this article will share in detail tips sharing files from both side. I used a folder called "ShareToUbuntu" between Windows and Linux.

A short to describe below three elements cover up entire process,

1. Setup Windows sharing folder sharing access rights

2. Setup sharing folder path in Virtual Box.

3. Execute mount command for the virtual box share folder.


So what software I have used here?

Windows 

Windows 10, Oracle VM Virtual Box

Linux

Linux - Ubuntu 18.04  OS installed in Windows Oracle VM Box. 

I'm in Windows 10 OS, installed Oracle VM Virtual Box and installed Ubuntu 18.04 OS.

So how do you actually setup sharing folder in window?






1.Setup Windows sharing folder sharing access rights

Let's define a folder location you would like to create share folder.


1. Go to your windows explorer, drive C:\

2. Create a folder called example "ShareToUbuntu

3. Right click folder and properties choose "Sharing" tab

4. Click on "Advanced Sharing" button

5. Tick "Share this folder

6. Click on "Permissions" button

7. Grant access permission 'Full Control', 'Change' and 'Read' to all

8. Click on "Apply" button - That's all done

In case you want to skip the above 8 steps; can follow up below image.

 


Create a shared folder in Windows


2. Setup sharing folder path in Virtual Box

Let's hope you now can have setup ready as mentioned in setting up share folder in windows directory may be C:\ Drive or D:\ Drive, depends on your choice.

Now let's get into Virtual Box.

You might question me - why do you have Linux Ubuntu in Virtual Box? 

Why not a standalone PC for Linux?

Its again depends on choice, how well to maintain server with low cost, having standalone PC may cause cost effective. 

Absolutely zero cost to have Oracle virtual box and Linux ubuntu 18.0 installed. 

That's all about my story, lets get into action.

Go to windows start, search for Oracle Virtual box - Download here 



Open Oracle Virtual Box



Click on Oracle VM Virtual Box,

Now VM Virtual Box Manager gets opened, choose Ubuntu 18.04 installed OS, and right hand side click "Start" to boot OS.


Open Ubuntu in Virtual Box



After clicked on start button, you may need to login as a user.

1. Choose "Devices" menu and click

2. Choose "Shared Folder Settings" sub menu


Now to complete the settings 

1.  Click on the icon marked in below image number 1

2.  Add share window opens up, choose the folder path you created in windows drive (number 2)

3.  Remember to choose the share folder "ShareToUbuntu" from Windows drive

4.  Finally, click on the "Select Folder" - that's all


Ubuntu Share Folder Settings 

So what happens after that?

This is the expected result as below image.

You should be able to view your share folder path provided.

Setting Shared Folder Path


Until now we almost completed our share folder settings

3. Execute mount command for the virtual box share folder.

Here is the actual action begin from executing a mount command 

To open command line window  short cut key Ctrl + Alt + T

1. Create a folder called "ShareToUbuntu" in command

~$  mkdir ShareToUbuntu

2.  Confirm the folder you created by command list

~$ ls

3.  Here you with mounting shared folder execute below command and enter

~$ sudo mount -t vboxsf ShareToUbuntu ShareToUbuntu 

4. Since you use sudo command, you must enter your password, that's all done.   



Next what?

Go to your windows shared folder place any file, and come back to Linux terminal to view that.

Demo Execution

I have placed a new file call "Transfer from windows to linux.png

Placed a new file in Windows Shared folder


Now I need to ensure it reflects in Linux Ubuntu 18.04 as well.

Switching to Linux Virtual Machine

As marked in below image .png file has been transferred to Linux.


Viewing Shared Files in Ubuntu Terminal


Note : You can also create a file in Linux with in shared folder, that reflects Windows shared folder as well.

Summary

So to conclude, this article we have seen three major sections for sharing a folder between Windows and Linux.  

1. Setup Windows sharing folder sharing access rights

2. Setup sharing folder path in Virtual Box.

3. Execute mount command for the virtual box share folder.

We created a common folder "ShareToUbuntu" in windows and configured the folder path in Linux Shared folder setup.

And finally, I have shared demo image of how I transferred a image file between Windows and Linux as an example. 

Hope you may like it, and I shall share more technical experience in finding solution and providing it step by step.