Accessing a Windows Share Folder with a Raspberry Pi

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:

Windows Share Screen One

Windows Share Screen Two

Windows Share Screen Three

Windows Share Screen Four

Windows Share Screen Four Point Five

Windows Share Screen Five

Windows Share Screen Six

Windows Share Screen Seven

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:

sudo apt-get install cifs-utils;

Now we will create a mount point in our home directory:

mkdir ~/ShareFile/

Now the configuration options I have are as follows:

sudo mount.cifs //192.168.1.7/ShareFile /home/pi/ShareFile/ -o user=yourWindowsUser,password=yourWindowsPassword

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?

What is fstab?

In order for your Raspberry Pi to mount the network shares on boot up, we need to modify the /etc/fstab file.

sudo nano /etc/fstab

There may be entries there already. All we need to do is add the following to the end of the file:

//192.168.1.7/ShareFile  /mnt/sharefile  cifs  username=yourWindowsUser,password=yourWindowsPassword,iocharset=utf8,sec=ntlm  0  0

Now we can manually run the same mount process at boot up from the command line by running:

sudo mount -a;

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.