Samba Server Installation (Demo)

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
21 hours 25 minutes
Difficulty
Intermediate
CEU/CPE
21
Video Transcription
00:00
>> Hey Cybrarians.
00:00
>> Welcome back to the Linux+ course here at Cybrary.
00:00
>> I'm your instructor, Rob Goelz.
00:00
In today's lesson, we're going to be
00:00
discussing Samba Server installation.
00:00
Upon completion of today's lesson,
00:00
you're going to be able to install that Samba servers
00:00
or roll on CentOS and Ubuntu.
00:00
Let's go ahead and get started with some demo time.
00:00
Okay, so here we are in
00:00
our demo environment and we're going to
00:00
be installing Samba on CentOS first.
00:00
We do that with the dnf command and we're going to
00:00
do dnf install Samba as
00:00
well as Samba-client and there we are.
00:00
Let that run in there we go yes,
00:00
we do want to install all
00:00
that as well as the dependencies,
00:00
Samba common tools and
00:00
Samba libraries and we hit ply to do that.
00:00
This is going to take just a minute or so to
00:00
complete and there we are
00:00
we are back to our command line,
00:00
let's type, clear to clear our screen.
00:00
Now what we'll do is we'll go ahead and enable Samba.
00:00
Now this is a little bit different
00:00
than what we've been doing before.
00:00
We're still going to use the enable
00:00
dash dash now command,
00:00
but we're going to use some neat brace expansion trick
00:00
here in bash.
00:00
We're going to see that we want to enable
00:00
both SMB as well as an
00:00
NMB at the same time
00:00
and we can do that by doing a curly brace,
00:00
SMB, NMB and then a
00:00
closing curly brace and then hit, enter.
00:00
We can see that it's created a same language
00:00
which means it's enabled both of
00:00
those services into multiuser target
00:00
so that I'll start with
00:00
a multi-user and now what we can do,
00:00
we can just do a status on both of these status can be at
00:00
slightly different we can just do a status,
00:00
SMB space NMB.
00:00
We can see that they are both running
00:00
and they're finished, erase all connections.
00:00
Good to go. Now we need to do is we need to
00:00
configure Samba to serve exports just as we did with NFS.
00:00
The way that we do that is by editing the file that is
00:00
an etc Samba, smb.
00:00
b, b.conf and there we go.
00:00
What we're going to do is we're going to add
00:00
a section way down here at
00:00
the bottom and we're just going to call
00:00
this section SMB share.
00:00
Now that we've added that section,
00:00
what we can do is we can specify a path to our share.
00:00
What we'll do is we'll hit, path and
00:00
we'll say that the path to our share is going to be,
00:00
mount and we're going to make up another share,
00:00
we'll call this one smb,
00:00
exp for export, and we're mounting SMB.
00:00
Next what we do is we can set guest to equal, okay.
00:00
This is going to restrict the share to
00:00
only users configured in the Samba database.
00:00
Sorry we're going to set guest okay, equal to, no.
00:00
Well actually that's all we need to do for this.
00:00
Let's go ahead and exit out of this
00:00
and we'll hit, escape colon wq.
00:00
Now to verify that this all looks,
00:00
we can run test parm,
00:00
and this will load the smb configuration file
00:00
[NOISE] there we go.
00:00
We're good to go off to the races.
00:00
Now what we need to do is we need to restart
00:00
in order to pick up the changes so we
00:00
can just arrow back to what we
00:00
had before and we do the same thing,
00:00
we do a system CTL, restart on these two.
00:00
We're all set, we do know their status on
00:00
these guys and we're good to go.
00:00
Now let's take a look at doing the same thing,
00:00
but over in Ubuntu.
00:00
Here we are in our Ubuntu environment
00:00
and in order to install Samba here,
00:00
it's just a one-liner app install Samba,
00:00
no additional client we need to install
00:00
just Samba itself and we hit,
00:00
enter and that'll go ahead and install it.
00:00
We'll see our lovely progress bar at the bottom,
00:00
we're going to wait for that to finish
00:00
and then we're going to do the same thing.
00:00
There we go we got the command line
00:00
back, let's hit, control L,
00:00
we got our prompt back, and we cleared our screen.
00:00
Now what we'll do is we'll system
00:00
CTL enable dash, dash now,
00:00
but slightly different information
00:00
inside of our curly braces here.
00:00
For Ubuntu we have to do SMB D because it's
00:00
the SMB daemon and we have to
00:00
do NMB D because it's the NMB daemon,
00:00
that's how it is specified in Ubuntu.
00:00
We hit "enter" and we're good to go those are all set,
00:00
we can do a system CTL status.
00:00
We can leave those in the curly braces too,
00:00
make life easier for ourselves and there we
00:00
go they're active and running, so we're good to go here.
00:00
Let's take a look at the configuration file,
00:00
let's clear our screen hit, control
00:00
L and now let's take a look at Vim,
00:00
etc Samba, SMB.conf,
00:00
that's a lot of information.
00:00
That's pretty noisy. Lot of examples.
00:00
Let's do this first, let's get out of here,
00:00
let's quit out of here,
00:00
and let's copy this file off so what we'll
00:00
do is we'll do copy etc Samba,
00:00
SMB.conf we'll copy that to
00:00
etc Samba
00:00
and we'll say SMB.conf.bak.
00:00
>> Now what we can do is we can use
00:00
>> a really helpful one layer with grep and
00:00
bash rather to get just the pertinent information out of
00:00
this file that we want
00:00
and so what we could do is we can say,
00:00
Hey, take the information out of this SMB.conf
00:00
file instead of grabbing everything,
00:00
let's just get the information that we need.
00:00
what we can do is we can do an SMB.conf.bak
00:00
>> and we're going
00:00
>> to grab that information and just put it into the
00:00
regular old etc Samba SMB.conf file that we have.
00:00
Now if we do this right,
00:00
we didn't miss any steps here,
00:00
it looks like we did, it looks like I missed
00:00
a closing single quotation mark.
00:00
Now if we go ahead and go back into this file with them,
00:00
we can see that that is a little bit more same,
00:00
little easier to read, right?
00:00
That's just a nice trick that I
00:00
found to you to clean things up.
00:00
What we'll do is the same thing we did before.
00:00
We're going to do at the bottom, we're going to do
00:00
SMB share and we're going to enter a line to the path,
00:00
path equals mount,
00:00
smb share or smb exp rather and we'll do smb.
00:00
Then let's add one more line down
00:00
here at the bottom and we'll say guest,
00:00
okay, equals no,
00:00
to ensure that only users configured in
00:00
the Samba database can access it.
00:00
We'll go ahead and we'll escape with
00:00
exit colon WQ to write and quit.
00:00
We'll do a test pattern
00:00
and we can see that that is loaded
00:00
services file is good roll standalone.
00:00
There's always service definitions,
00:00
we're off to the races.
00:00
Now same thing we did before.
00:00
We're going to go ahead and we're going to reload all of
00:00
the configuration by restarting the Samba service.
00:00
Instead of doing an enabled, now
00:00
we're just going to do a restart
00:00
on this, start.
00:00
Now we can do a system CTL status on this
00:00
as well just arrow back and there we go.
00:00
We can see that they're both loaded and good to go.
00:00
With that we've reached the end of this lesson.
00:00
In this lesson we covered installing and
00:00
configuring Samba on CentOS and Ubuntu.
00:00
Thanks so much for being here and I look
00:00
forward to seeing you in the next lesson.
Up Next