HowTo: Install & Configure Samba On Your Raspberry Pi in 5 Easy Steps

Inevitably during your time tinkering with your Raspberry Pi – a situation will arise that will require you to setup a Samba share. Setting up a Samba share allows us to easily access our chosen files & folders on the Pi and remotely copy, modify or create new files from any machine on the network.

I’ve broken this guide up into 2 sections – essentially the step by step guide will walk you through setting up a fully accessible network share without having to worry about the actual permissions of our target files & folders. While the next section dives into securing your network share properly and troubleshooting common problems that you may encounter along the way. ~Enjoy

 

Setting up Samba


 

1.)  Download and install Putty so we can remote into the command line interface for our Raspberry Pi.

2.) Connect to your Raspberry Pi via Putty.

RaspberryPi_Connect_viaPutty

Default Credentials:

User: pi
Pass: raspberry

 

3.) Install Samba

 

4.) Next, we need to edit our Samba configuration file to define what exactly we want to share.

Scroll to the end of the the file. (ctrl+v to get there quickly)

Then add something like the following:

Obviously you will need to adjust the path & comment fields to accommodate which folder structure you would like to share. Also, for anyone that has changed their default Windows workgroup – you will need to specify your unique workgroup name under the global section.

 

5.) Finally, save & exit. (ctrl+x)  you should now be able to see your Pi’s shared folder in Windows.

SharedFolder_Windows7_SambaPi

 

If you still don’t see the your shared Pi folder – Try rebooting your Samba Service

 

 

A Quick Note On Security…


 

By default, new folders that are created or even most existing folders have the following permissions set by default:

Permissions_wSamba

The way we have configured our samba share in the steps above allows “guest access”  to have the ability to read and execute files and folders in our Samba directory. We’ve essentially bypassed some of the write restrictions quite simply by adding the following line to our above Samba configuration:

 

While this works, granting full permissions to everybody on your network  isn’t really best practice.So Let’s refine our Samba security – We’ll start by opening up our Samba.conf file again.

And once again we’ll scroll to the bottom, only this time we are going to make a few key changes…

 

Then we just need to create our samba user & password. In this case we will be using our existing account “pi”. When prompted feel free to set your password to whatever you would like…

 

Finally – To connect to your now secured Samba Share – We will want to create a mapped network drive.

Browse to:  Start > Computer > Map Network Drive

Then simply enter your server location and samba share name – making sure to check the box “Connect using different credentials”.

ConnectSambaDirectory_WindowsMappedNetworkDrive

 

 

 TroubleShooting


 

[learn_more caption=”Not Seeing your Samba Share”]
  • Verify that your workgroup name matches what is in samba.conf
  • Try restarting the samba service:
  • Refresh your network view in windows explorer

 

If none of the above resolve the problem – Please feel free to leave me a comment below and I’d be happy to help.

[/learn_more] [learn_more caption=”Permission Denied”]

If you are on a private & secure network – The default configuration covered at the beginning of this guide should suffice and would require no credentials during setup.

Alternatively, If you require your Samba shares to be locked down in your network environment and are having difficulty resolving permission denied errors – Please try the following:

  • Try re-doing the samba user setup process for pi:
  • Comment out any additional changes you may have made that deviate from what is covered in this guide and try once more with the default settings.
  • If you want to take the easy way out – You can simply grant full access to the folder:
  • If you are trying to setup a samba share on a mounted directory…You may need to apply the proper permissions. For Example:
     
[/learn_more] [learn_more caption=”connecting to a domain (VS a workgroup)”]

Simply replace the workgroup line..

with…

 

[/learn_more]

 

 

Pin It on Pinterest