149 lines
11 KiB
Plaintext
149 lines
11 KiB
Plaintext
|
|
Episode: 4136
|
||
|
|
Title: HPR4136: Pi Samba Share
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr4136/hpr4136.mp3
|
||
|
|
Transcribed: 2025-10-25 20:06:03
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
This is hacker public radio episode 4136 from Monday the 10th of June 2024.
|
||
|
|
Today's show is entitled Pi Samba Share.
|
||
|
|
It is hosted by Kebi and is about 13 minutes long.
|
||
|
|
It carries a clean flag.
|
||
|
|
The summary is setting up a Samba Share on your Pi for when you're streaming services
|
||
|
|
are down.
|
||
|
|
Hello hello this is Kebi from the Tuxtam podcast and I'm going to continue my wee series just
|
||
|
|
out on my use for Raspberry Pi's.
|
||
|
|
Now this next one that I'm going to talk about, I'm going to first of all speak about
|
||
|
|
it and why I use it and then if you're still interested I will actually go over about
|
||
|
|
how to set this up.
|
||
|
|
So this is setting up the Raspberry Pi as a Samba server.
|
||
|
|
Now you may be thinking to me why in the world would you do this?
|
||
|
|
For starters you know Samba servers really aren't very secure, it's certainly to open them
|
||
|
|
up this will not give you or certainly I would not recommend you do this if you want
|
||
|
|
your files out and about.
|
||
|
|
However the reason I have the Samba server set up is because we're at a stage now where
|
||
|
|
everything we have is streamed so whether you're using different forms of radio, TV, whatever
|
||
|
|
you consume your media generally without the internet in our household anyway.
|
||
|
|
We can actually do nothing.
|
||
|
|
What I did was a few years ago and to be honest I'm quite glad I didn't know was I took
|
||
|
|
all my DVDs, all my CDs and ripped them and put them onto an external hard drive and
|
||
|
|
I actually got rid of the physical things themselves.
|
||
|
|
So I've got all my music and all my videos, things like that on one specific external hard
|
||
|
|
drive.
|
||
|
|
I decided then to plug it into our Raspberry Pi that I wasn't using and set that up
|
||
|
|
as a Samba server.
|
||
|
|
The biggest advantage is that if the internet is down or if even the internet is rather
|
||
|
|
intermittent and streaming can prove quite splotterly then this is something you've got.
|
||
|
|
You can follow back to this.
|
||
|
|
Now just I thought I'd wee bit more context you may think okay just switch on your local
|
||
|
|
television.
|
||
|
|
Yeah there's a slight problem with that where I live you can get television but since
|
||
|
|
I switched off analog TV, digital TV is only really available for those who want to
|
||
|
|
install an aerial and it doesn't have to be an outside aerial but certainly a loft aerial
|
||
|
|
a standard set top aerial will not work.
|
||
|
|
I have tried it and it's just constantly breaking up and it's not really watchable.
|
||
|
|
Let's just put it that way.
|
||
|
|
So this is what led me to use this and of course the other benefit is one I am not wasting
|
||
|
|
a bunch of physical space storing DVDs and CDs anymore and plus the other thing is
|
||
|
|
I actually don't have any optical drives anymore so this is something I'm glad I did because
|
||
|
|
if I wanted to do it now I would have to go and physically buy USB DVD drive which is
|
||
|
|
not really something I want or particularly need for that matter.
|
||
|
|
So that is my reason for using it.
|
||
|
|
I've actually got an old Raspberry Pi 2 and this works dead easily so it does the job
|
||
|
|
you really don't need to be wasting power and extra money by a Raspberry Pi 4 or anything
|
||
|
|
in fact before this I actually had an original Raspberry Pi running it and the thing was
|
||
|
|
it was working fine up until we had a bit of a per search and I lost quite a number
|
||
|
|
of electronic components that was actually before I actually had the anti-serge stuff connected
|
||
|
|
to it was actually after that I bought that and in fact I've got bad places now because
|
||
|
|
not only did I change over the main power board to the house I also put an anti-serge plug
|
||
|
|
on to all my computer and pies.
|
||
|
|
If you are still listening then I'm going to go over now how to actually do this.
|
||
|
|
Now put all these in the show notes so first of all what do you need?
|
||
|
|
You're going to need a pie and again an old pie is absolutely fine as long as it works.
|
||
|
|
You're going to need a micro SD card now we're not storing anything on that at present
|
||
|
|
so you just need enough to run the OS so 8GB generally is more than enough.
|
||
|
|
I would recommend that you use an Ethernet cable for this don't rely on with the Wi-Fi
|
||
|
|
because at the end of the day you're using this at a time when you need to stay and you
|
||
|
|
want this to be reliable.
|
||
|
|
You are also going to need an external hard drive now if you've got a pile of old CDs
|
||
|
|
and DVDs especially the DVD side of it then I strongly recommend you get a large hard
|
||
|
|
drive it does not have to be solid state it's because all you're going to be doing is
|
||
|
|
accessing these things and you're not going to need for rapid speed so if you've actually
|
||
|
|
got an old hard drive then which I'm pretty sure we all do stick it inside a case and
|
||
|
|
connect it but that's essentially what you're going to need to have this.
|
||
|
|
However a couple of maybe other things you may need you're either going to have to
|
||
|
|
have a HDMI cable or something disconnected to a monitor you'll also need a mouse and
|
||
|
|
a keyboard there are a wee caveat though you can if you want just SSH into this pie that
|
||
|
|
is also perfectly acceptable.
|
||
|
|
Make sure if you have an external drive that it's powered because the Raspberry Pi doesn't
|
||
|
|
generally have enough power to power a large external hard drive it's not a thumb drive
|
||
|
|
we're talking about here it's generally an actual drive so you might want to get something
|
||
|
|
that's powered.
|
||
|
|
So the first thing we're going to need to do is install Samba that's dead easy so first
|
||
|
|
of all make sure your pie's up to date so in the terminal pseudo-opt update pseudo-opt upgrade
|
||
|
|
and then we want to install Samba so pseudo-opt install Samba this will also install Samba
|
||
|
|
common as well so you've got all these things let it run through that do its thing what
|
||
|
|
we need to make sure of is that a hard drive is mounted what we want to make sure of is
|
||
|
|
that we have the actual address of the hard drive now the easiest way that I found to do that
|
||
|
|
is just to use pseudo BLKID and this will give an output and they'll give you two things
|
||
|
|
there'll be two different types so one will see fat 32 we can ignore that completely that
|
||
|
|
is simply the Pi SD card but there'll be another one there and chances are depending what
|
||
|
|
you set it up it might be like X4 or whatever it's going to be so we want to take the UUID
|
||
|
|
and the type the the rest of the stuff there isn't important at this point we need to mount
|
||
|
|
this drive automatically whenever the Raspberry Pi switched on so we want to put up a directory
|
||
|
|
where it's going to automatically always wanted to be in the same place for a Samba share to be able
|
||
|
|
to connect pseudo MKDIR and then put it wherever you want so for my case I just put it on the media
|
||
|
|
folder and call it external so pseudo MKDIR slash media slash external or whatever you want to call
|
||
|
|
now what we want to do is edit the FS tab to tell Raspberry Pi to auto mount the external drive
|
||
|
|
every time it's switched on so to do this you do pseudo nano forward slash ETC forward slash FS tab
|
||
|
|
and you want to do UUID equals and then in inverted commas or quotation marks I should say in
|
||
|
|
quotation marks you want to stick in the UUID that we did and then put in where you're going to
|
||
|
|
do so in my case slash media slash external the next option is to put in the file type that again
|
||
|
|
was noted in the previous step and then put down now it's up to you again but you don't want to put
|
||
|
|
down auto comma user comma rw and then after that the two options 0 and 0 so we want to make sure
|
||
|
|
that these all have spaces in between them that just allows it to auto mount and also becomes
|
||
|
|
writable given that this is not been open to the public this is only for in your own area
|
||
|
|
if you know I'm quite happy to have this writable the reason I have it writable is in case I do
|
||
|
|
want to transfer stuff onto it or as well maybe I've watched something a bit too much and I just
|
||
|
|
decided that I won't rid of it then you can also delete as well the next thing we're going to need
|
||
|
|
to do is set up which folders are going to be shared personally I'm going to assume that you
|
||
|
|
want the whole of the external drive to be made available over the network and to do this you do
|
||
|
|
sudo nano forward slash etc forward slash samba forward slash smb.com and that'll open up a page if you
|
||
|
|
don't want to use nano that's fine use whatever it takes editor you want but that's just my
|
||
|
|
preferred option and at the bottom of the page we need to add the following first of all you want
|
||
|
|
the squared brackets and call it a name I just called my next journal and then path equals I'm
|
||
|
|
putting whatever you've added to again so my mind's forward slash media forward slash external
|
||
|
|
available equals yes plausible equals yes public equals yes unrightable equals yes it's worth noting
|
||
|
|
before we continue I've set writable equals yes and this means that you can add to remove contents
|
||
|
|
to the external drive over the network if you're not comfortable with that that's fine just change
|
||
|
|
that but make sure you put down writable equals no now want to make sure we save that exit it so
|
||
|
|
on nano that's control x and make sure you answer yes we'll now set up the Raspberry Pi to log in
|
||
|
|
automatically on startup so if the user isn't logged in then all of the things we've just set up
|
||
|
|
will not work first of all type in pseudo nano forward slash etc forward slash init tab
|
||
|
|
and you want to kind of navigate down to the line that says one colon 2345 colon respawn colon
|
||
|
|
forward slash s bins forward slash getty dash dash no clear 3840 zero space TTY one so something like
|
||
|
|
that and you want to add after the forward slash s bin forward slash getty you want to add
|
||
|
|
dash dash auto login space pi now that's a few users pi if you've changed to a different user
|
||
|
|
you're going to have to change that word pi but you want to auto login now before we do anything
|
||
|
|
else we're going to need one more piece of information we're going to need to find the ip address
|
||
|
|
of the pi now I'll assume that that's something you will know however if if you don't actually
|
||
|
|
use this quite easy way to do it just in the pi type in if config space eth zero and you'll be
|
||
|
|
given a line and part of it will be the address so that's just where it is now before you actually
|
||
|
|
go and come off the pie or or break your ssh just reboot it and if all goes well everything
|
||
|
|
your system should be up and running all you just do then browse the network find your pie double
|
||
|
|
click on it and search it okay and honestly that's it this is actually a dead easy one it's a
|
||
|
|
bit long-winded and i'm not expecting you to have followed me along perfectly however what i
|
||
|
|
would say is head over to the show notes and i'll put everything you need there hopefully this
|
||
|
|
is another project that i've got and it just gives you an idea over something else now please
|
||
|
|
can i please emphasize do not open this port case sambas not secure enough to let it go to
|
||
|
|
the outside world you really do risk losing everything this is just purely an internal thing
|
||
|
|
this is not a replacement for own cloud or next cloud or whatever whatever it is you use
|
||
|
|
like this is purely a sambasher to be used an internal network please folks do not open this out
|
||
|
|
to the world for the sake of your own files okay so as i said before this has been kevi from a
|
||
|
|
tux jam podcast and this was another episode about things they do with my pie
|
||
|
|
you have been listening to hacker public radio at hacker public radio does work
|
||
|
|
today's show was contributed by a hbr listener like yourself if you ever thought of recording
|
||
|
|
podcast and click on our contribute link to find out how easy it leads posting for hbr has been
|
||
|
|
kindly provided by an honest host.com the internet archive and our syncs.net on the satellite
|
||
|
|
status today's show is released under creative comments attribution 4.0 international license
|