How To Increase Ssh Session Timeout In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1.Edit /etc/ssh/sshd_config:
Open /etc/ssh/sshd_config with a text editor.
2.Set the ClientAliveInterval option
Find the line starting with ClientAliveInterval. If the line does not exist, add it to the end of the file. Set the interval in seconds, for example to set a timeout of 5 minutes, set it to 300.
ClientAliveInterval 300
3.Set the ClientAliveCountMax option
Find the line starting with ClientAliveCountMax. If the line does not exist, add it to the end of the file. Set the count to 0.
ClientAliveCountMax 0
4.Restart sshd
Once the configuration is changed, restart the sshd service to apply the changes.
sudo systemctl restart sshd
1. To increase the SSH session timeout on the Linux server, you can edit the sshd_config file to set a higher session idle time limit.
2. Open the sshd_config file using any editor. It is usually located in the /etc/ssh directory.
3. Look for the line that contains the parameter ClientAliveInterval and set it to the number of seconds of idle time you want to allow before the SSH session is terminated. For example, if you want the session to be terminated after 15 minutes of idle time then set the value to 900.
4. Save the file and restart the SSH service to apply the changes. This can be done using the following command: # systemctl restart ssh
5. You can verify that the changes have been applied by connecting to the SSH server and looking at the value of the parameter ClientAliveInterval.