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 2

Terminating SSH connections, part 2

- You may find that you want to auto-terminate sessions after a specific amount of inactivity. This used to be available within the OpenSSH server. And if we look at our server, we'll see there was two items that you would modify: ClientAliveInterval, and ClientAliveCountMax. But as of OpenSSH 8.2, that was discontinued. So I'm going to show a way to auto-terminate any session into the terminal for the individual user, and globally. So let's get out of here and not save that file. And at the SSH server, what I'm going to do is I'm going to configure a timeout for our user, and then globally. We'll start with the individual user. And what I'm going to do is I'm going to create a new file for our user account. So I'm going to do a vim on /home/user. And I'm going to create a new file .bash_profile. If there is a .bash_profile already, you can just augment that. But on this server, there is no such file for the user account, so I'm creating a new one. And in that file, I'm going to use…

Contents