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

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