From the course: Complete Guide to Linux Security: Protecting Your Linux Server Environment
Unlock this course with a free trial
Join today to access over 24,300 courses taught by industry experts.
Terminating SSH connections, part 1 - Linux Tutorial
From the course: Complete Guide to Linux Security: Protecting Your Linux Server Environment
Terminating SSH connections, part 1
- Let's show how to terminate SSH connections. By default in Linux, sessions can run for a long time. It might be that you want to terminate them earlier. So we're going to show how to do that and we'll start at our server. And the first thing I want to do at my SSH server is run pgrep -c sshd. When we press Enter, we see that there is one connection. This shows how many SSH connections there are. That is the local administrative SSH connection and it's always going to be there. Now, let's go ahead and connect via SSH from a client to the server. And I'm going to use two terminals here, so we'll move this one over and create a second one over here. And let's make an SSH connection. And we're in. Good. We'll go back to the server. And you know what, let's run tmux right now over here so that we can split this and have two, and we'll run that command again with a pgrep -c sshd. Now we see three connections, but don't worry, this is normal. This shows the SSH connection from the client…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Learning objectives1m 18s
-
(Locked)
Review of SSH1m 47s
-
(Locked)
Using keys to connect via SSH12m 57s
-
(Locked)
The sshd_config file3m 19s
-
(Locked)
Modifying the default SSH port7m 32s
-
(Locked)
Disabling password-based SSH2m 57s
-
(Locked)
Disabling root login via SSH2m 32s
-
(Locked)
Exclusive SSH groups4m 37s
-
(Locked)
Authentication settings10m 6s
-
(Locked)
Terminating SSH connections, part 17m 45s
-
(Locked)
Terminating SSH connections, part 26m 51s
-
(Locked)
-
-
-
-
-