Samba Raspberry Pi: A Local NAS Storage.

Setup Windows to access a Raspberry Pi

Setup Samba for Raspberry Pi and Windows PC

With this reliable setup that has been tested and verified by our staff, you will be one step closer to having a Home Network  Storage Solution. It can be apart of a bigger project like we are building with our Smart Home or a standalone


The 5 Steps

1.) Update and Install Repos
2.) Setup a Shared Directory
3.) Create backup
4.) Configure Access
5.) Create User
6.) Extending Your Install into a NAS

1.) Update and Install Repositories and Files needed for samba install

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


2.) Setup a Shared Directory

We will make this a sticky Directory with read/write/execute permissions for everyone

sudo mkdir -m 1777 /dir-to-share


3.) Create a backup of CONFIG

We are creating a backup of our Config file for safety and preventive maintenance

sudo cp /etc/samba/smb.conf.backup


4.) Configure Access and Add Directory

sudo leafpad /etc/samba/smb.conf

a.) Now Change the workgroup to your homegroup, I find leaving the wins support = no left alone works also. You can test with it if your having problems.

workgroup = WORKGROUP NAME

b.) Add these lines to your Share Definitions

  Comment=Pi shared folder
  Path = /share
  Browseable = yes
  Writeable = Yes
  only guest = no
  create mask = 0777
  directory mask = 0777
  Public = yes
  Guest ok = yes

Now let’s walk through this.

Comment: is, of course, a description of your current share.
Path: is the location of the folder you would like shared.
Browseable:, is yes or no, asking if browsing the directory is allowed.
Writeable: Is asking if you the user is allowed to write or change files.
Only Guest: would be asking if only users that are guest is to be allowed.
Create Mask: is your file permissions for read/write/execute. Look Here for a Little help.
Directory Mask: would be the same as Create mask, except pertaining to folders.
Public: is asking if the share is Public or Private.
Guest OK: is asking are guest allowed.


5.) Create User and Start Samba

sudo smbpasswd -a pi

Follow the prompt and enter a password I use the same as my current Password You may use what you like.

sudo /etc/init.d/samba restart

Now Enjoy your newly added Network Device! Browse to your Network Folder and you should see “RASPBERRYPI” Unless you have Changed your HostName.


6.) Extending Your Samba Install

We are going to add an external hard drive to our Samba for Raspberry Pi Than we are going to mount it to the Raspberry Pi, for access from a PC or other device. This is useful if you are looking to build a small NAS. The speeds aren’t that great due to having to use the USB 2.0 connectors on the Raspberry Pi.

First Command we need to run is for NTFS Support.

sudo apt-get install ntfs-3g

Now we need to find our drive so we can add it to our startup configuration

sudo fdisk -l


Now a lot of this is unessacary to us, we are looking for ” /dev/sda1″ or possibly a little differnt if you have more drives connected.

Now we are going to create a directory for us to mount the drive to.

sudo mkdir /media/SDA1


Now we are going to use the fstab command to mount the drive. 

/dev/sda1 /media/SDA1 auto nofail,uid=enter_uid_here,gid=enter_gid_here,noatime 0 0


The Setup process for this command can be found at Ubuntu_Fstab_wiki Here is the schema to follow

[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]

Now we are going to restart our Pi and your drive should mount. You can CD to it and check. Now we need to add our drive to our samba config.

sudo nano /etc/samba/smb.conf

Scroll to the bottom and add these lines.

  Comment = NAS Green Drive
  Path = /media/SDA1
  read only = no
  browsable = yes

Now Restart your samba and browse to your network folder and once you’re inside the Raspberry Drive. You should see a “nas” Folder.


Stay tuned as we update this post into a FULL Cloud-based NAS System.

1 comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.