Configuring SSH Connection Timeout Interval

Some OSs have a timeout limit by default. You can modify the environment variable TMOUT and the sshd_config file to prevent frequent timeout prompts.

  • Change the value of the TMOUT environment variable. The value 0 indicates that there is no timeout limit. The value can be set to a positive integer, indicating the maximum inactive time (in seconds) of a session. For example, if TMOUT is set to 600, the login of a user is automatically terminated if the user does not perform any operation within 10 minutes.
    export TMOUT=600
  • Modify the ClientAliveInterval and ClientAliveCountMax fields in the sshd_config file based on the security requirements of your organization.