Disconnecting Inactive SSH Connections in Linux Last Updated : 19 Feb, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report SSH or Secure Shell is a cryptographic network protocol that establishes a secure connection between systems remotely. Any user can use this protocol to manage the system remotely but mainly system administrators use it because it transmits data over encrypted channels, which increases its security at a high level. SSH can be used to manage the system, move between files and folders, etc. To disconnect inactive or idle SSH connections we have to set the timeout period for an SSH within which if a server does not receive any request from the client then it will disconnect the connection. Follow the steps to set the timeout period for an SSH connection: Step 1: On the server, head over to the /etc/ssh/sshd_config configuration file. $ sudo vi /etc/ssh/sshd_config Step 2: Scroll and locate the following parameters and remove the '#' symbol to uncomment it: #ClientAliveInterval #ClientAliveCountMax Here, ClientAliveInterval: Sets a timeout interval in seconds after which if no data has been received from the client, sshd will send a message through the encrypted channel to request a response from the client. In simple ways, the number of seconds that the server waits before sending a null packet to the client.ClientAliveCountMax: Sets the number of client alive messages which may be sent without sshd receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session. The timeout value is given by the product of the above parameters i.e. Timeout value = ClientAliveInterval * ClientAliveCountMax For example let's define our parameter ClientAliveInterval = 30 ClientAliveCountMax = 3 The Timeout value will be 30 seconds * 3 = 90 seconds. This is an equivalent of 1 minute and 30 seconds, which implies that your ssh session will remain alive for idle time of 1 minute 30 seconds without dropping. Step 3: Once done, reload the "sshd" for the changes to come into effect. $ sudo systemctl reload sshd Comment More infoAdvertise with us Next Article Disconnecting Inactive SSH Connections in Linux A anurag702 Follow Improve Article Tags : Linux-Unix Similar Reads Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co 11 min read Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance 10 min read Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact 12 min read Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and 9 min read 3-Phase Inverter An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power 13 min read Polymorphism in Java Polymorphism in Java is one of the core concepts in object-oriented programming (OOP) that allows objects to behave differently based on their specific class type. The word polymorphism means having many forms, and it comes from the Greek words poly (many) and morph (forms), this means one entity ca 7 min read Linux Commands Cheat Sheet Linux, often associated with being a complex operating system primarily used by developers, may not necessarily fit that description entirely. While it can initially appear challenging for beginners, once you immerse yourself in the Linux world, you may find it difficult to return to your previous W 13 min read CTE in SQL In SQL, a Common Table Expression (CTE) is an essential tool for simplifying complex queries and making them more readable. By defining temporary result sets that can be referenced multiple times, a CTE in SQL allows developers to break down complicated logic into manageable parts. CTEs help with hi 6 min read What is Vacuum Circuit Breaker? A vacuum circuit breaker is a type of breaker that utilizes a vacuum as the medium to extinguish electrical arcs. Within this circuit breaker, there is a vacuum interrupter that houses the stationary and mobile contacts in a permanently sealed enclosure. When the contacts are separated in a high vac 13 min read Linux/Unix Tutorial Linux is one of the most widely used open-source operating systems. It's fast, secure, stable, and powers everything from smartphones and servers to cloud platforms and IoT devices. Linux is especially popular among developers, system administrators, and DevOps professionals.Linux is:A Unix-like OS 10 min read Like