Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at

hpr4136 :: Pi Samba Share

Setting up a Samba share on your Pi for when your streaming services are down

<< First, < Previous, , Latest >>

Thumbnail of Kevie
Hosted by Kevie on 2024-06-10 is flagged as Clean and is released under a CC-BY-SA license.
Pi, media, server, samba. (Be the first).
The show is available on the Internet Archive at:

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:12:56


We live in a time where everything is streamed; from our TV, radio, podcasts everything is fine until the internet goes down. Gone are the days of simply turning on the TV with a set top aerial. With this in mind, I set up an old Raspberry Pi 2 and connected it to use as a video and music server through a Samba share.

To complete this task you will need:

  • A Raspberry Pi
  • A micro-SD card
  • An Ethernet cable
  • An external hard drive (min 2TB recommended)

Step 1: Update your Pi software in the terminal:

sudo apt update && sudo apt upgrade

Step 2: To allow us to share our files over a network we will install Samba:

sudo apt install samba

Step 3: To find UUID and the file system of the drive, enter:

sudo blkid

Ignore the line with fat32, this is your Micro-SD card.

Step 4: We need to mount this drive automatically whenever the Raspberry Pi is switched on. Firstly, we'll need to create a location to mount the external hard drive, we can do this by using the command:

sudo mkdir /media/external

Step 5: Now we need to edit the fstab to tell the Raspberry Pi to automount the external drive every time it is switched on

sudo nano /etc/fstab

Insert the following line at the bottom of the page:

UUID="{the UUID you noted down in step 3}"     /media/external   {type noted in step 3}     auto,user,rw      0     0

The above should all be on one line, pressing the tab key to create a gap between each piece of information.

Step 6: Now we need to set up which folders are going to be shared. I'll assume that we are going to make the whole of the external drive available over the network

sudo nano /etc/samba/smb.conf

At the bottom of the page add the following, note that you can call this anything you wish, just exchange the word external but you must include [ ]:

path = /media/external
available= yes
browsable = yes
public = yes
writable = yes

It's worth noting before we continue that I've set the option writable = yes, this means that you can add to or remove the contents of the external drive over the network. If you are not comfortable having this option then simply change it to writable = no. Now save and exit (ctrl + X), make sure that you answer 'yes' to save your changes.

Step 7: We will now set the Raspberry Pi to log in automatically on startup, if the user Pi isn't logged in then all of things we've just set up will not work. Type:

sudo nano /etc/inittab

Navigate down to the line:

1:2345:respawn:/sbin/getty --noclear 38400 tty1

and add --autologin pi after getty to make the line:

1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1

Save and exit (ctrl + X) make sure that you answer 'yes' to save it.

Step 8: We can try it out our system and auto-login by using the command

sudo reboot

Assuming that everything goes well, your system should be up and running. Try and find it on a computer through the file manager. I personally recommend saving the Pi location on Kodi for an easy to use solution for browsing your media on a TV.


Subscribe to the comments RSS feed.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Anti Spam Question: What does the letter P in HPR stand for?