• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Fix "Putty session keeps disconnecting when idle"

    I was facing this issue on most of my machines where the putty terminal was getting disconnected when it was left idle for few minutes so every time I had to log in back to work on the terminal.

    Putty session disconnects when left idle for few minutes

    # vi /etc/ssh/sshd_config 
    ClientAliveInterval 0
    ClientAliveCountMax 3
    By default these values are set to 0

    Let me explain what is the meaning of the above parameters


    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. The default is 0, indicating that these messages will not be sent to the client.


    Sets the number of client alive messages which may be sent without 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.

    # vi /etc/ssh/sshd_config 
    ClientAliveInterval 60
    ClientAliveCountMax 5
    Add this line as shown in the following file
    # vi /etc/ssh/ssh_config
    ServerAliveInterval 60
    Create a file at this location if it does not exist
    # vi /root/.ssh/config
    Host *
    ServerAliveInterval 60
    NOTE: Make sure you give a space before ServerAliveInternal as shown above
    # service sshd restart
    So now every 60 seconds ssh client will send a message through encrypted channel to the server so that the session does not disconnects when left idle.
    And the default threshold value for the messages to be received is 5 which means that the client to server session can tolerate or skip 5 messages before it disconnects the session.

    Next time when you do ssh to any client use the following command:
    # ssh -vvv "client IP or hostname"

    Fix "Putty session keeps disconnecting when idle" Fix "Putty session keeps disconnecting when idle" Reviewed by admin on Wednesday, September 05, 2012 Rating: 5

    1 comment:

    1. This post was really helpful

      One of the good blogs to follow up :))


    Powered by Blogger.