Social Icons

How to Setup Samba network share on Raspberry Pi

Raspberry Pi is one of the hottest thing in the tech world today with endless utilities. One of the common use is to set up a NAS (Network Area Storage) server, which you can access over your home netlibpam-smbpasswork (Wired LAN or WiFi).

Assuming your storage drive (USB HDD in this case) is already mounted we will proceed with the steps. If you haven't followed the steps to mount your USB HDD yet then follow my other guide here, and then return to this point.

Step 1.
Install Samba
sudo apt-get install samba samba-common-bin

Update: Install libpam-smbpass (For auto sync of unix user passwords)
sudo apt-get install libpam-smbpass

Step 2.
Backup Samba configuration file, and then configure Samba
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup

Edit smb.conf
sudo nano /etc/samba/smb.conf

You can copy over the configurations from the below snippet replacing the path to your mounted USB drive.

Step 3.
Restart Samba
sudo service samba restart

You should be able to access your NAS from any windows / unix system using the following path \\RaspPiNAS

Remember you will require to provide credentials of a valid user as added on Raspberry Pi to be able to access the share. If you want it to behave differently then change the settings for security = user and valid users = @users related parameters.


  1. Nice guide. 1 small thing i had to alter to be able to log on to my USB HD was no spaces in the comment under [RaspPiNAS]

  2. If you run into "Failed to restart samba.service: Unit samba.service is masked." error ->
    replace 'samba' to 'smbd', since Debian and debian-derivatives changed the service name from 'samba' to 'smbd'. Cheers.