[No audio]
SSH and TELNET. These are the two main
services that run in Linux to accept
connections from outside. Telnet is an
old and unsecure connection between two
computers. And a lot of companies don't
use telnet anymore. The SSH is a newer
connection established protocol that is
completely secure. There are two types
of packages for most of the services
that you see on a Linux machine. One is
a client package, and the other one is a
server package. So you have a server, it
sends a connection request, an SSH
request, to another server. So in this
case, you are the client and the
computer you are trying to connect is a
server. So let's take it the other way.
So if you on the right hand side, and
the server is on the right hand side,
when it tries to sync it's time to you,
as through the NTP protocol, then it's
no longer the server, it becomes a
client, and then you become the server.
So let's look at our SSH and telnet.
Both of these, those services that we
have and how they work in our computer.
[No audio]
I will connect it through the PuTTY
session, and I'll confirm I am root.
Let's clear the screen. And the service
that runs, the first one is telnet. So
when you run telnet, you will see it
says command not found. Why? Because by
default, now Linux don't include telnet
in the installation. So if you have to
install telnet, you will have to do
yum install telnet, and it will go to
the repositories, and it will find, it
will match the the option I have for
telnet, and it found one package. And
it's telling me, do you want to download?
Now we will not be using telnet in our
environment, but if there is, if you are
troubleshooting, telnet is sometimes a
tool that allows you to troubleshoot
some of the issue, some of the network
communication issues. But for this
lesson, we'll just skip that, and we
don't want to download that. Next one,
we have the SSH. Do we have SSH? Yes, we
do, that's why we got this usage of SSH.
We could do ssh to followed by the IP
address of the remote computer. But
since we don't have a remote computer,
we'll just say local computer, which is
the same box that we're trying, we are
already logged into. When you do, hit
enter, yes, you're logging in as root.
So put in the root password. And you log
into the same machine that you were
logged in before. So you can create as
many sessions as you want. So you can
exit out and you will come back to your
first session. To check the service of
sshd, we'll run ps -ef to see if the
process is running. And you'll see the
process is right here. It says /usr/sbin/sshd.
This is the process that is
actually listening for all the incoming
traffic. If I stopped this process, I
will not be able to log into this
machine anymore. But before we do that,
I wanted to check my IP, and my IP
address is 192.168.1.12. And let's
go ahead and stop the sshd service, and
you hit enter, you get the prompt back.
It means it's not running. You could do
ps -ef again to grep it, and you
will see the sshd and sshd this is, this
already established connections, this is
telling me, but it is not showing the one
we looked for before. We just use it as
an sshd. So it means it will not accept
any incoming sessions anymore. How can
we confirm that? Let's log into a new
PuTTY, session and I will put in the IP
address of this machine again 192.168.1.12.
[No audio]
See, it says network error connection refused
because there is no SSHD daemon that
is running. So we'll click OK. Close
this out, and this time we'll start the
sshd process. It has started because we
got a prompt back. How do we verify it?
You can run ps -ef again sshd, and
you will see right here, the process is
running now. Now it will accept the
connection. Another way to find out if
that service is running is by doing
systemctl status sshd, and right here
is telling you active, active, and
running. So now if you try to connect to
that IP one it wants you to want that
well, you should be able to 192.168.1.12.
Bingo. You see how SSHD
works. So this is how you could stop the
connection to your server or refine or
restrict your computer. This is
an enhanced way to implement security on
your system. Good luck.
[No audio]