How To: Share files between Windows and Linux

Avatar

When you are in a network with multiple operating systems, you might have trouble sometimes finding out the interactions between them. Some things are easier to do than others and sharing files is one of the easiest things to setup. Although you could go with a third-party service or even use cloud storage, sometimes you want to be secure and fast by sharing files via LAN. This guide will show you exactly how to do that in these two operating systems.

From Windows

First of all, you will need to enable the sharing capabilities in Windows.

1. Type in “Network and Sharing Center” in the search box and click on the result that appears.
2. In the left side of the window, click on “Change advanced sharing settings.
3. Check the “Turn on network discovery” and “turn on file and printer sharing” settings. Hit Save changes.

WindowsLinuxSharing2

4. Go to the file you want to share, right click on it and choose Properties. Navigate to the Sharing tab.

WindowsLinuxSharing3

5. Click on Advanced Sharing. Tick the “Share this folder box”. Click on Permissions. You can now either add the users you want to share with or just use “Everyone” and give full
permissions by checking all the boxes under Allow. Click on Apply and close the windows.

WindowsLinuxSharing4

6. Navigate to the Security tab. Check if the users you added on the Sharing tab are here. If not, be sure to add them and give them the same permissions otherwise they will have restricted access to the files. Click on Apply and close the windows.

WindowsLinuxSharing5

You should now be able to access all of the files in Linux using the operating system’s interface. If not, you can mount them through the command line by mounting the Samba shares.

Use this command first: sudo apt-get install cifs-utils
And then use this command: mkdir ~/YourDesiredFolder/Windows-Share
 sudo mount.cifs //WindowsPC/Share /home/YourUsername/Desktop/Windows-Share -o user=YourUsername

Remember to change the appropriate paths to fit your own folder locations and your username. You will be asked for the passwords of both the Linux system and the user account of Windows.  If you do not have Samba, simply use this command: sudo apt-get install samba

From Linux

This is far easier and less time consuming than the Windows version. You will need Samba and the command line.

1. First command: mkdir ~/YourFolder. Change to fit the folder you want.
2. Configure the smb.conf file with whatever editor you want using this: sudo vi /etc/samba/smb.conf
3. Copy and paste these lines to the end of the file and replace the values with your own:
<folder_name>]
path = /home/<user_name>/<folder_name>
available = yes
valid users = <user_name>
read only = no
browsable = yes
public = yes
writable = yes

WindowsLinuxSharing6

Go to Windows, right click on the Desktop, create a Shortcut and use the IP address of the Linux machine combined with name of the Folder you have shared, like this:
\\192.168.0.1\FOLDER

Follow the rest of the steps of the shortcut creation and you are done!