Samba shares are useful for various reasons. They allow you to access a directory over a network from any device running virtually any software. You can create a samba share on your Raspberry Pi and make it available to Windows, Mac OSX and Linux machines. You can even access them on Android and iOS devices (iPhones). This will allow you to manage your media library from any device in your home so you can copy movies or TV shows onto an SD card or usb stick to take with you on a long trip. If you are running XBMC you can add the samba share as a movie or TV library and play the files over your home network. If you have two Raspberry Pis you can use one as a media server sharing files to Pi number two running XBMC Kodi with Raspbmc. This will only take about 5 minutes and will make life far more convenient.
If you are trying to figure out which hardware would work best for you, consider reading the Pi benchmarks.
Pi Unit | ||||||||
---|---|---|---|---|---|---|---|---|
Raspberry Pi 3 | Quad Core | |||||||
Raspberry Pi 2 | Quad Core | |||||||
Raspberry Pi | Single Core | |||||||
Banana Pi | Dual Core | |||||||
Banana Pi Pro | Dual Core |
Create Samba Share on Raspberry Pi
Install the samba software
sudo apt-get install samba samba-common-bin -y
Make sure your user is the owner of the path you are trying to share via Samba
sudo chown -R pi:pi /path/to/share
Take a copy of the original samba share file
sudo cp /etc/samba/smb.conf /etc/samba/smb.bak
Edit the samba configuration file
sudo nano /etc/samba/smb.conf
Leave workgroup as WORKGROUP
Uncomment WINS support, change this line, it should enable the NETBIOS name RASPBERRYPI on your network
# wins support = no
to
wins support = yes
I am going to add my TV show folder in /mnt/usbstorage/TV
Now you need to go to the bottom of the file, use Ctrl+V to skip down to the bottom quickly
Paste this code, you may have to uncomment force user = root by deleting the # if you can't access the share, it may also be necessary to enable write access to the share from remote machines
If you don't want to be able to delete files you can delete the read only = no
line
[TV] #This is the name of the share it will show up as when you browse
comment = TV Folder
path = /mnt/usbstorage/TV
create mask = 0775
directory mask = 0775
read only = no
browseable = yes
public = yes
force user = pi
#force user = root
only guest = no
Assuming the hostname of your pi is RaspberryPI, the path of this share is now \\RASPBERRYPI\TV
or \\RASPBERRYPI.IP\TV
Ctrl+X, Y and Enter to save and exit nano
Set a samba password for pi
sudo smbpasswd -a pi
Restart the samba server¨
sudo service samba restart
If you are on Jessie you may see this error, it is because of systemd. With init.d on previous debian releases samba restarted both smbd and nmbd, now it doesn't.
samba.service
Loaded: masked (/dev/null)
Active: inactive (dead)
You need to restart these services separately instead
sudo service smbd restart
sudo service nmbd restart
Now try to access the samba share, if all is well, repeat the process by editing smb.conf again and adding additional shares.
NB: You may need to restart your device as well as any Mac or Windows machines you want to access the samba shares.