Install Samba Server on the Raspberry Pi

Samba is a free software for UNIX which provides the SMB (Server Message Block Protocol), which has originally been developed by Microsoft. In practice that means that it enables you to emulate the file- and printer services of Microsoft Windows. That means, you can share files and printers within your network.

To install Samba Server on your Raspberry Pi follow the steps:

Step 1

Update and Upgrade your system
$ sudo apt-get update && sudo apt-get upgrade

Step 2

Install Samba
sudo apt-get install samba samba-common-bin

Step 3

Open the Samba .config
sudo nano /etc/samba/smb.conf

And remove the hashtag (#) in front of
# security = user

Step 4

Create a Samba user for the user “pi”. The same user has to exist on the Raspberry Pi (for example to log into SSH), but he should not have the same password.
sudo smbpasswd -a pi

Step 5

Now we have to give the Samba user the rights to access the later shared folders. In this example I’ll give him the rights to access my USB drive.
sudo chown -R pi:pi /media/usb1

Step 6

Now we need to edit the Samba config again.
sudo nano /etc/samba/smb.conf

path = /media/usb1
writeable = yes
guest ok = no

Replace the path with the path to your shared folder.

Step 7 (optional)

You may have to rename workgroup, depending on whether Workgroup’s name has been changed on the computers accessing the Samba server.
workgroup = WORKGROUP

Step 8

Restart the Samba server and you are ready to go :)
sudo /etc/init.d/samba restart

To share more devices simply repeat the Steps 4 – 6 and don’t forget to restart the server after the changes.

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>