please remember that the complete
information for the class that you are
about to view is at Eli the computer guy
comm not only do we have our videos
there but we have parts lists diagrams
pictures and even complete code examples
so if you are watching this video and
you want more information please go to
Eli the computer guy comm welcome back
as you know I am Eli the computer guy
and in today's class I'm going to be
showing you how to install samba onto
your Raspberry Pi OS on your Raspberry
Pi so let's say you're creating a
Raspberry Pi projects but you don't want
to actually have to physically write the
code on the Raspberry Pi itself you look
at the Thani IDE and you think that
looks like a crappy IDE I would prefer
to actually be able to do my code
actually right out on my code on my
laptop or whatever my primary driver is
and then simply be able to copy and
paste that code over to the Raspberry Pi
rather seamlessly well by installing
samba essentially what you're able to do
is you're able to create file shares on
your Raspberry Pi operating system that
are accessible from the desktop from a
Mac or a Windows computer so just like
you would go into a network and you
would be able to basically double click
into servers I'll be able to double
click into shares in the network you
will now be able to do that once you've
installed a Samba onto your Raspberry Pi
OS it is important to understand that
whenever you're trying to do anything in
the Linux world there's always multiple
ways to actually try to accomplish
something so many times when people try
to upload code or download code from a
Raspberry Pi they would use FTP File
Transfer Protocol the thing is with that
generally you need an additional client
something like FileZilla and you have to
go through a whole process to actually
be able to upload code onto your
Raspberry Pi that can be a little bit
cumbersome if you have your Raspberry Pi
on the same network as your your primary
computer though by installing samba
again what this allows you to do is you
can simply copy and paste you can
basically interact with the file share
on your Raspberry Pi OS just like you
would any other folder or file that
you're used to in a normal
stop operating system so I'm going to be
showing you how to install samba today
and how to do the basic configurations
so the warning warning for today's class
is I'm going to show you how to install
samba and I'm going to show you how to
do the basic configurations in order to
be able to share folders with samba the
thing is is we're not going to go deeply
into a Linux security in this particular
class so if you do everything that I
show you how to do today you are going
to be able to copy and paste files and
folders onto your Raspberry Pi but
essentially there's there's got to be no
security here there's gotta be no
security the files and folders that
you're gonna be putting on your
Raspberry Pi are going to be wide open
so you're going to need you to go in and
you're going to need to configure the
permissions properly if you actually
want to close down these files and
folders to actually make your
environment secure so what I'm going to
be showing you today is very good for
your own personal lab environment so my
little lab environment in my house with
multiple layers of routers between me
and the internet something like this is
completely fine again if you're in your
home if you're in your own environment
this is great to be clear to be clear if
you are in a production environment and
you do what I tell you to do today and
you don't add any other security you
probably should not be in this job
snot beating this job so I just want to
make that clear here we are not going
into security security as an additional
thing I've done classes before on how to
deal with file and folder security and
Linux so go take a look at those and
then actually close down the security on
the files and folders they are going to
be having on your Raspberry Pi but the
cool part about samba is if you
understand a file and folder security
adding Samba - your Raspberry Pi is
actually like shockingly easy like
within a couple of minutes you can have
your file shares up and running and then
like I say you can actually be doing all
of your code and whatever IDE you prefer
on your primary computer and then you
can simply copy and paste that code to
the Raspberry Pi and go from there so
with that let's go over to the Raspberry
Pi and I will show you how to install
samba and how to do the configurations
ok so here we are my Raspberry Pi so
this is a completely clean install the
only thing that I have
added is apache2 so I have installed the
Apache 2 webserver just so we have a
folder that we can share so I can give
you a bit of a demonstration there so we
do one 27.0 o 0 dot 0 dot 1 we can see
that we have the default Apache page
coming up so the first thing that we
need to do is we need to actually
install samba so we're going to open up
our terminal and then in order to
install samba literally all we have to
do is sudo apt - get install samba and
then that's all we're gonna need to do
to install samba so it's gonna ask you
yes if we want to we do yes and then
we're going through and it's doing the
configurations to actually be able to
install samba so here if your computer
gets his IP address information from a
DHCP server blah blah blah you may also
have wins servers so this is something
that I would say you might just want to
say yes if you don't know if you don't
know whether or not you have win servers
you might as well say yes here just in
case so wins was basically a Microsoft
of variation of DNS that they tried to
make successful years ago there may be
reasons that this will actually help
within your particular network
environment so unless you know that you
don't need wins I would say yes here I
don't think it really should cause you
any problems if you say yes oh then it's
going to go through and it's gonna keep
you know unpacking all the stuff and
actually it's going to install samba for
us it's a pretty quick little process
here again all told it will take about a
minute or so to actually install samba
so the installation is done now and what
I want to do is I want to create a
folder that's actually going to be
shared on the network initially so I'm
going to go up here to this final manage
here I'm going to open this and as we
can see here I'm logged in as pi so I'm
under root the home directory and PI
what I'm going to do is I'm going to
right-click I'm going to do it do a new
folder and here I'm simply going to say
share I'm then going to do ok so this
will be the file share then what I need
to do is we are going to need to do with
permissions just a little bit I can
right click on this
sher I can go down to properties and
then I can modify the permissions so
view contents anyone what I'm going to
do is I'm going to change you can change
a contents to anyone and access the
contents to anyone so basically this is
going to make this particular folder a
wide-open for for the Raspberry Pi then
I'm going to simply click OK click yes
and now that security is done from here
what we need to do is we actually need
to modify the Samba configuration file
so I'm going to type in sudo nano now if
you followed me for any length of time
you know I prefer vim I just a VM guy
right you know text editors in the Linux
world different people like different
text editors I generally prefer them but
you know why we're using nano because
it's the default installed in Raspberry
Pi and it doesn't really matter again
when you're modifying configuration
files it doesn't really matter what text
editor you're using since Nano is
already installed with the Raspberry Pi
we're just gonna use that because you
know that's how I roll oh then we're
going to go on a route under etc' under
samba and then we're going to go to the
SMB conf configuration file so do sudo
nano so that's the that's a file editor
et Cie samba SMB contract and when we do
this it's going to open up this SMB
configuration file and these are the
configurations for Samba there's some
interesting configurations in here and I
actually probably will do a more
sophisticated Samba class going into the
future but all we really need to do
right now is literally just go to the
end of the file we're not gonna worry
about any of these other configurations
those are cool neat amazing
configurations that I should teach you
about at some point but right now right
now I'm not going to deal with those
configurations what I'm going to do is
down here at the bottom I can actually
add the configurations for the folder
that's going to be shared from this
particular server so when I do the
brackets come I do these brackets and
basically whatever is between these
block block brackets is going to be the
name of the share so we have a shared
folder and we're going to simply call it
share
so you know and literally you could call
it Bob
you could call it whatever you want and
that's what it'll actually show up on
the UH on the network neighborhood or
whatever then we're going to go down
we're going to tab in and then we were
going to say what the path is so path is
going to equal and then we're going to
do home PI share alright so if we go up
here basically we're going to go here so
this this is the folder path we want to
go so forward slash home for it / PI
forward slash air basically whatever the
name of this folder is that's what you
got to put here so if you put something
else that's fine
then we're going to go here to read to
set read-only and we're going to equal
no because we actually want to be able
to write to this then we're gonna do
public equals yes because this is gonna
be public we want to be accessible and
then we're gonna say a right bow and
we're also going to equal yes so
basically this is all we need to do here
so we say what the name of the share is
going to be we say what the path to that
shared folder is going to be before
we've done this though we do have to
make sure that the security for this
particular folder is correct again
that's where you do right-click
properties you can go to permissions
make sure anyone can get to it or
however you want the security being read
only equals no because we want to be
able to write to it publicly equals yes
because we want to make it accessible
and writable equals yes because we want
to be able to write to it from here
we're going to control X save a modified
buffer we are going to say yes then this
here you just hit enter so basically
it's saying what what filename do you
want to write to see so if you wanted to
modify the filename for some reason you
can modify it here we don't want to
modify the file at filename we want it
to be the exact same thing we want to be
we want to have it saved as SMB comp so
we're going to simply hit enter and now
that's what you've got so basically now
this share is going to be accessible
from the network but before we go over
to the demonstration computer I do need
the IP address so if we're actually
going to be accessing the server we need
what
you know what the IP address is so I'm
simply going to type in IP address and
it will give us our IP address so we
take a look here we've got the loopback
and here is our Ethernet address
192.168.1.3 so 224 subnet mask so I can
now use this to actually be able to
access this server from my demonstration
computer so let's go over to the
demonstration computer and I should be
able to pull this up so we can come here
I can go to go I can do connect server
we can see SMB 192.168.1.2 3 we can
click on connect it's trying to connect
I'm simply going to do guest because it
should be wide open we're then going to
do connect it's going to offer us that
shared folder we are going to do ok and
now we are in the shared folder so if I
want to do something let's say I have
these screenshots so again let's say I'm
creating a website or basically I just
want to be able to very easily upload
these files to a server basically I can
just take those I can literally copy and
paste then we go back to my Raspberry Pi
we can go to the folder we can go to
share and now we can see that these
images are now simply sitting in that
folder so again this is especially
important if you need to upload like a
lot of graphics files you need to upload
a lot of different like code files that
type of thing this is something that you
should think about doing so one of the
things that we can also do here is we
can create an additional share on this
particular Raspberry Pi for something
such as the website right so as I showed
you before if we open up the web browser
I do have the web server running on here
so if we do one 27.0 dot 0 dot 1 right
that brings us to this default web page
so what if I want to actually be able to
edit this page or put in a new page from
my main my laptop computer what I can do
is I can go here let's clear the screen
the first thing that I need to do is I
need to change the ownership of the HTML
folder so again this gets a little bit
into security but hopefully you can
follow along so we're going to do soo
we're gonna change own to PI /var for
size www four slash HTML right so the
HTML folder is the one that we care
about so what we're going to do is we're
going to change the owner of this folder
to the user PI so currently the HTML
folder is owned by root so when it's a
default installation it's owned by root
this could be a pain in the butt when
you're trying to actually do some
modifications there's some edits so
we're simply going to change the owner
to PI and then we're going to hit enter
and so now the owner is PI then the next
thing that I'm going to do also to make
my life easier as I'm going to do sudo
change mod chmod 777 basically what this
is going to do is this is going to give
full permissions to the HTML folder so I
can access it very easily from my my
laptop computer again this is something
that you have to be careful about from a
security perspective you do not want to
do this in a production environment
again because it's basically it's going
to make this folder completely open for
the for the network but again in a
demonstration a lab environment this
will make your life a lot easier then
I'll hit enter and so now
pi is the owner of the HTML folder and
the HTML folder now is completely open
as far as permissions are concerned so
past that what I then want to do is I
want to go back and I want to reopen the
SMB comm file and I want to add a new
share for that HTML directory I'm going
to open this up we come back to the SMB
comm file we're going to scroll all the
way down again again we're not gonna
mess with any of this all this cool
stuff up here we're not gonna mess with
we're gonna come down here and then we
are going to go oh I don't know what do
you want to say web root so we're just
going to create a share called web root
and then we're gonna close the bracket
so remember anything in the bracket
that's gonna be what the name of the
share is then for this we're gonna say
is path equals /var for size www for
worse I think you know
then we're gonna make a read-only equals
no then we're going to say public equals
yes then we're gonna say write a bowl
equals yes also so make sure I did not
fat figure anything since this is a
class I think all of that looks good so
then what we're going to do is we're
only gonna do control X to exit do we
want to save yes we want to save do we
want to save it as this filename we just
simply hit enter here because of yes and
so now that is being shared out we then
just also for good measure should
actually restart the Samba service so
can simply do sudo service and then for
the Samba service it's a little bit
different its SMB D so SMB daemon and
then we simply do restart and once we do
that that'll restarted the service and
so from there we can actually go back to
my demonstration computer from here we
can go up we can you do go again we can
connect to server' 192.168.1.2 3 you can
do connect and now we can see that their
share and there is web route so I can
click on web route and I have now access
the web root folder so we can see that
the index file is there so if I want to
go in and want to modify that or edit
that somehow I could do that I could
also simply move it to trash so if I
literally want to get rid of it I could
simply delete it and now it's gone and
if I then go back to the the raspberry
pi I then come here reopen the web
browsers are going to go to 1.7 dot 0
dot 0 dot 1 we can see that we now get
an error because that web page no longer
exists so if I wanted to create a web
page again on my laptop or my primary
computer and be able to simply copy and
paste over I can now do that and so
that's really all there is to setting up
a Samba server on your Raspberry Pi OS
and how to configure the shares with it
just make sure you do remember the IP
address so make sure you get the IP
address you can actually connect the
Raspberry Pi also restart the Samba
service if you have any
having any issues with connecting to
your Raspberry Pi using the the files
and folders that connect on your
computer restart the Samba service and
then again do you realize this is
completely wide open so this is not a
secure insulation by any stretch of the
imagination so be careful with that so
there you go now you know how to install
samba onto your Raspberry Pi again to be
clear the installation and the
configurations that I showed you how to
do today are very very very basic again
imagine this is for a little
demonstration environment again this is
for for your desk your you're trying to
figure out how to write some code that
thing that type of thing for the
Raspberry Pi you would prefer to be able
to write that code on your primary
computer and then be able to just copy
and paste it over to your Raspberry Pi
what I showed you how today that that
will work very good for that particular
situation if you then want to put your
Raspberry Pi into a production
environment no no make sure you lock
down the security and figure out all the
Linux security and all that kind of
stuff again what I showed you how to do
today is wide open which makes it easier
for you in a lab environment to work on
but makes it just horribly Vonn because
I mean it's just wide open it literally
is just wide open the other thing to
realize too is that with the Samba
server software there is more to it you
can actually do a lot of interesting
things with Samba I just literally
showed you how to do the file shares
today because again in the raspberry pi
OS environment that's basically just
white what I want to focus on but the
Samba software itself you can do a lot
of interesting things and I probably
will do a more complicated more in-depth
class on that going into the future if
you want to learn more about it again by
all means go out there do a google
search there's lots of tutorials and you
might actually be surprised with how
powerful Samba can be and again how
powerful Samba can be on a simple little
Raspberry Pi if you want something like
a file server for your local your local
network let's say you have a business
and you simply want to spin up a little
file server plug in some USB hard drive
that may have two or three terabytes of
storage on it simply using a Raspberry
Pi with samba might actually solve all
your problems you may not need
active you know Microsoft Active
Directory server it's gonna cost you
$3,000 literally a $50 Raspberry Pi
Samba and a USB hard drive that you plug
into it that may actually do more than
you need it to so just one of those
things to be thinking about if you want
to look into some but a little bit more
so as always I enjoyed doing this class
before to see how the next one if you
like the content that I create please
think about going to e line the computer
guy comm and becoming a member or
donating please understand that all the
educational videos are in front of the
paywall
that includes the videos that includes
the notes the diagrams and the code
example all of that is freely available
and in front of the paywall but if you
want to watch opinion videos or if you
want to be able to comment you do need
to become a member
membership is $5 a month or $60 a year
and gives you access to those opinion
videos and the ability to comment if you
don't want to become a member you just
want to give a one-time donation there
is also a donate button where you can do
that please understand in order to
provide the education that I am it does
cost money the servers cost money
equipment cost money travel cost money
all of these things cost a reasonable
amount of money and the fact of the
matter is is YouTube's advertising
program no longer supports creators in
the way that it used to so if you want
to these classes to continue to stick
around and you find them to be valuable
please think about either becoming a
monthly member or donating a few dollars
for this project