File Sharing from Your Raspberry Pi to PC using Samba

How to set up file sharing on the Raspberry pi using Samba Share.

There are many, many posts on the interwebs with instructions on how to set up file sharing on your Raspberry Pi. There are also many videos on youtube. But one site I found had some pretty simple instructions, using Samba. But, below I added a little more detail.

Open a terminal and install samba using this command (or access your Pi through ssh):

sudo apt-get install samba samba-common-bin -y

Be sure and type Y to continue.

Once complete and add user pi to the local smbpasswd file:

sudo smbpasswd -a pi

You will be asked to add a username and password.

Then you need to edit the samba config file to set permissions.

sudo nano /etc/samba/smb.conf

file sharing using samba

Use the down arrow key on your keyboard to move to the area that says, Global Settings.

file sharing using samba

And make sure where it says “workgroup = workgroup”. Then uncomment (remove the # sign) the line that says “wins support”and change the no at the end to yes.

For now, save the file by holding down ctrl button on the keyboard and then hit the x key. Lift off of the ctrl key and x and then hit the y key and enter. It should save it.

Then you need to make a share folder. You can do it through the command prompt in the terminal (at prompt type mkdir and then a name for your new folder) or open your file directory and create a “share” folder. I just simply created one named “share” in my /home/pi directory. But you can also give access to any existing folder there, like the Picture folder, as long as you add the correct path (example: /home/pi/Pictures).

Now open the samba conf file again with sudo nano /etc/samba/smb.conf and move the cursor down until you get to the very end of the document. Then put in your path to the file.

Something like this:

[share]
path = /home/pi/share
available = yes
valid users = @users
read only = no
browsable = yes
public = yes
writable = yes

Save changes (ctrl x, y, enter).

Then back at the prompt, restart samba.

sudo /etc/init.d/samba restart

Then you should be able to browse your shared folder on the Pi with from most PC’s.

Now, this is what worked for me. If you know a better way, please comment below!

Learn more about using Samba, here.