Disabling Root Login via SSH (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 there, Cybrarians,
00:00
and welcome back to the Linux
00:00
Plus course here. It's Cybrary.
00:00
I'm your instructor Rob Gills, and in today's lesson,
00:00
we're going to cover disabling root login via ssh.
00:00
Upon completion of today's lesson,
00:00
you are going to be able to understand the importance
00:00
of disabling root login via ssh and
00:00
then we're going to see how we can modify
00:00
the ssh server configuration to
00:00
disable root login during the demo in this lesson.
00:00
As we know by now, the root user has
00:00
complete privileges over the entire Linux system.
00:00
Therefore, it's critically important that we limit
00:00
the remote access that
00:00
the root account has to the system.
00:00
In order to do this, what we need to do is modify
00:00
the open ssh server configuration so
00:00
that we block the ability to log in as root over ssh.
00:00
Let's see how this is done with some demo time.
00:00
Here we are in our environment, and today,
00:00
we're going to be working in a [inaudible].
00:00
We're going to modify the open ssh configuration
00:00
to disable root login via ssh.
00:00
Again, this setting is configured on
00:00
the server side of the ssh configuration.
00:00
Remember that is the etc/ssh/sshd_config file,
00:00
not the ssh_config file.
00:00
The easy way to remember that is sshd,
00:00
d for daemon, that's going to be the server.
00:00
What we're going to need to do is
00:00
edit etc/ssh/sshd_config, and we're
00:00
going to do that by using a pseudo edit command
00:00
because we need to become root in
00:00
order to modify this file.
00:00
We're going to do sshd_config as pseudo edit,
00:00
and now I'm going to type in my password to become
00:00
root temporarily and modify this file, and there we go.
00:00
Now, what we're actually looking for is
00:00
the line that says permit root login.
00:00
I'm just going to do a search.
00:00
What I'm doing is I'm typing forward slash,
00:00
and then I'm just typing the word permit,
00:00
and if I hit "Enter", I can see the first occurrence,
00:00
and the first occurrence does happen
00:00
to be permitted root login, so we get lucky there.
00:00
What we're going to do here is we're going
00:00
to uncomment this line,
00:00
and then what I'm going to do is hit "Insert" on
00:00
my keyboard by hitting the I key,
00:00
so I just hit I for Insert, and now inside of here,
00:00
I can change this from permit
00:00
root login without password to know.
00:00
Then we're going to go ahead and hit
00:00
"Escape" and then colon
00:00
WQ to save and close out of this file.
00:00
Now, in order to pick up this change,
00:00
we have to restart that sshd daemon.
00:00
The way that we do that as a pseudo system ctl,
00:00
restart, sshd.
00:00
Now that that's done,
00:00
we're going to probably also want to
00:00
check and make sure that the restart took.
00:00
The way that we can do that is
00:00
by bringing a status command.
00:00
We're going to do pseudo system ctl status on sshd,
00:00
and we can see that it's active and
00:00
running, so this is accomplished.
00:00
Now this is completed, the root user
00:00
can no longer log in to the system via ssh.
00:00
With that, we've reached then end of this lesson,
00:00
and in this lesson,
00:00
we covered the importance of disabling
00:00
root login via ssh and really
00:00
limiting the ability of that root user
00:00
to login because of the damage it can cause.
00:00
Then we talked about how to modify
00:00
the ssh server configuration to
00:00
disable that root login in our demo.
00:00
Thanks so much for being here,
00:00
and I look forward to seeing you in the next lesson.
Up Next