Jinshu Peethambaran
LinkedInAbout Me
  • AWS
    • Disable SSH Timeout on EC2
    • Deploy Amazon ElastiCache, a fully managed Redis service
    • Elastic Cache: Redis Connectivity from the Internet
    • Exporting AWS WAF Logs to Splunk via S3
    • Add new user to EC2 Instance
  • Zero Trust
    • Zero Trust in Database Security - Overview and Key Considerations
    • Zero Trust for Datacenter Workloads
  • Engineering
    • Change RDP Session Time Out
    • RegEx for Sensitive Data
  • Miscellaneous
    • Automated Deployment - Apache Guacamole
    • Characters allowed in a domain name
    • Automated installation of Nuclei on a MAC/Linux
    • Upload local directory codes to a new GitHub repository
Powered by GitBook
On this page

Was this helpful?

  1. AWS

Disable SSH Timeout on EC2

The automatic logout on EC2 running Debian 12 is typically due to the SSH session timing out or a terminal session timeout. You can disable these timeouts by adjusting the SSH and shell settings. Here are the steps you can follow:

1. Disable SSH Timeout

To prevent SSH from timing out, you can modify the SSH server configuration:

Open the SSH server configuration file:

sudo nano /etc/ssh/sshd_config

Find and set the following parameters (if they are not present, add them):

ClientAliveInterval 120
ClientAliveCountMax 720

ClientAliveInterval 120 sets the interval (in seconds) after which the server will send a message to the client requesting a response to keep the connection alive. In this case, it is set to 120 seconds.

ClientAliveCountMax 720 sets the number of client alive messages that can be sent without receiving any messages back from the client. In this case, it is set to 720. Combined with the ClientAliveInterval, this allows for a 24-hour (120 seconds * 720) timeout.

Save the file and exit the editor (Ctrl+O, Enter to save, Ctrl+X to exit).

Restart the SSH service to apply the changes:

sudo systemctl restart sshd
NextDeploy Amazon ElastiCache, a fully managed Redis service

Last updated 11 months ago

Was this helpful?