Accessing a Windows Share Folder with a Raspberry Pi
16 Feb 2015- 8/25/2016 - Updated fstab section down below *
Reasons why?
Okay, I’ll admit it. I have other computers I use that aren’t Raspberry Pis. Hell, they’re on completely different operating systems. A recent problem I had was sharing files between the two. How would it be possible to look at a Windows network share folder from a Raspberry Pi?
First we create the share folder on Windows!
I’m running Windows 8.1 and creating a network share folder is pretty straight forward. If you already have a share folder on your Windows computer you can skip ahead to the next line item. At a glance the steps are as follows:
- Bring up the Network screen by searching “Network”. It will be your first listing:
- Click the “Network and Sharing Center” icon in the toolbar:
- Now click the “Change advance sharing settings”. We are going to confirm we have everything we need enabled for the next steps.
- We will now enable Network discovery and enable file and print sharing:
- Now bring up a folder you would like to share. Right mouse click and go to “properties”. You should now see a “Sharing” tab towards the top. Go ahead and click it:
- Now we will go to the “Advance Sharing” section. Then click on “Advanced Sharing”:
- From this screen we have lots of options. But the one we’re more worried about is setting the correct permissions to the users who will have external access to this share folder. Click on the “Share this folder” checkbox and then the “Permissions” button:
- We will now grant access to a user that exists on our Windows machine. I went ahead and applied all the permissions:
- Now we will exit all the Windows screens.
Mounting the share on our Raspberry Pi
Now let’s switch gears to our Raspberry Pi. We will be mounting the Windows share to a directory on our Raspberry Pi.
We will need to install cifs-utils. This will help us mount SMB directories- which is what we get from Windows. We can install easily on Raspbian by running the following command:
Now we will create a mount point in our home directory:
Now the configuration options I have are as follows:
- Windows share folder is named “ShareFile”
- My Windows user is named “yourWindowsUser”
- My Windows user’s password is “yourWindowsPassword”
- My Windows computer’s IP is “192.168.1.7”
You should now be able to navigate your Windows shared files by going into the mount point which is named “ShareFile”.
Updated! Permanent mount point using fstab
Now that we have all we need to mount a directory. Wouldn’t it be nice if your Raspberry Pi can mount these directories automatically every time we boot up?
In order for your Raspberry Pi to mount the network shares on boot up, we need to modify the /etc/fstab file.
There may be entries there already. All we need to do is add the following to the end of the file:
Now we can manually run the same mount process at boot up from the command line by running:
If no errors are present, then you’ve successfully added the configuration needed. At this point I usually reboot my Raspberry Pi for good measure to test.
Questions?
Have you run into any snags? Let us know how we can help by posting a comment below.