
How to avoid Putty time-out disconnection
This guide explains how to avoid timeout disconnection after connecting with putty to a server. Putty is a Windows client that allows you to connect in SSH, RAW, Telnet, Rlogin or serial mode. This client is widely used and I find it very useful because it provides a clean interface and a copy-and-paste system that I really appreciate.
First you have to connect with the putty to the server, then you have to click on the icon at the top left to open the context menu. Then select ‘Change Settings’. A window similar to the window you used to connect will open. In this window at the bottom left select ‘Connection’ and in the text box with the name ‘Seconds between Keepalive (0 you switch off)’ you must enter the number ‘3’. Click the ‘Apply’ button and for this connection you will not be disconnected due to inactivity.
If you are still in doubt about how to do this and I should not have made myself clear, you can view this short video to better understand how to do it.
In this video, you are shown how to prevent the putty client from shutting down. I think it might still be useful to explain why this happens and not just how to prevent it through an in-depth analysis. Any element that connects to another needs to know whether the other party is still there and is receptive.
In this case, the programme that interfaces with the service is called a client and the specific name is putty. This application was developed by a British team consisting, at the time of writing, of Simon Tatham, Owen Dunn, Ben Harris and Jacob Nevins. It is a very simple programme that is widely used in computing by all those people who do not want or cannot give up getting their hands on a Unix-like system, without necessarily leaving Microsoft Windows.
What is putty
Putty is a suite of free clients that are also distributed in portable form. Normally, however, in the jargon, when we talk about putty, we refer to the secure shell client ssh. It is definitely a must-have application on the classic USB stick of enthusiasts and professionals.
The suite thus includes ssh client, scp, sftp, telnet, key generator and show. The telnet client is the classic method of connecting to old systems, it is important to understand that it can be done in any port, the important thing is that there is some compatibility and we know the commands. The ssh client is a more advanced system because it associates encryption keys, making the connection more secure. The sftp client establishes secure connections, it was created to compensate for the initial lack of encryption from the ftp protocol, which has since been resolved.
PC on the other hand is the traditional file exchange system in Linux systems, it uses the same ssh encryption technology, it takes a while to learn how to use it. However, a visual client called winscp is also released that is quite intuitive and aesthetically similar to an ftp client. The key generator takes care of generating the keys needed for any secure shell connection and the show stores them.
Since there is no automatic software update system, it is useful to always keep an eye on the putty developers' site. The email address to contact the developers can be found at the bottom of the putty bug page.
However, there are other programmes for handling ssh connections on Windows, but I am used to this now and will not change, also because putty has a copy-and-paste system very similar to the linux system. Otherwise, I have not been able to find the same comfort in other programmes (many of them paid). However, this is a subjective thing I suppose.
How Putty's connection works
Putty is a client for ssh, telnet and rlogin connections. Shssh is an acronym for ‘secure shell’. A shell, in the IT field, is a medium through which the user communicates with the machine in a language more similar to human language than machine language. Putty allows you to establish an ssh (secure shell), telnet and rlogin connection in order to interact with the server system by sending commands and displaying responses. I will try to explain some of the basics below very clearly at the cost of sounding imprecise. The purpose of this article is really only to solve the problem.
Why the putty connection expires
The putty connection expires because, in order to avoid unnecessary suspended connections, a timeout is set on both the client and server side. If this were not the case, the connection would always remain active on the server side and thus the ssh service would suffer from consuming resources unnecessarily due to processes that are dead and purposeless. Another reason for a putty disconnection could be related to a loss of connection, temporary or otherwise.
Why the proposed solution to prevent a putty disconnection works
As already written, putty checks to see that the server-side connection is still active. Since it does not transmit anything by default when it is in an idle state, when it is called, e.g. by pressing a command on the keyboard, it detects that the server-side connection is no longer available and issues a timeout message.
Obviously, the developers foresaw this and gave the possibility of sending a signal to the server to warn it that it is not in a permanent idle state. Thus, if you set the value to 1, every second this message will be sent to the ssh server which will keep the channel open and available for that connection.