<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to Increase SSH Connection Timeout in Linux	</title>
	<atom:link href="https://www.tecmint.com/increase-ssh-connection-timeout/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.tecmint.com/increase-ssh-connection-timeout/</link>
	<description>Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks.</description>
	<lastBuildDate>Mon, 05 Dec 2022 21:57:42 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Brett Gersekowski		</title>
		<link>https://www.tecmint.com/increase-ssh-connection-timeout/comment-page-1/#comment-1924911</link>

		<dc:creator><![CDATA[Brett Gersekowski]]></dc:creator>
		<pubDate>Mon, 05 Dec 2022 21:57:42 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=38499#comment-1924911</guid>

					<description><![CDATA[This &quot;solution&quot; to set an idle timeout seems quite common on the internet, but it&#039;s not actually correct. I am looking for a way to get the ssh daemon to enforce an idle timeout for users, which it seems many others are also looking for. Unfortunately, this is not what &lt;strong&gt;ClientAliveInterval&lt;/strong&gt; and &lt;strong&gt;ClientAliveMaxCount&lt;/strong&gt; do. 

If you set &lt;strong&gt;ClientAliveInterval&lt;/strong&gt; to a non-zero value, the server will send &lt;strong&gt;ClientAlive&lt;/strong&gt; messages over the encrypted channel if it doesn&#039;t see traffic from the client for that many seconds. This allows the client to respond over the channel that it is still alive and allows the server to clean up sessions where either the network connection has been interrupted or the client has died without gracefully disconnecting. 

So if you set the interval to &lt;strong&gt;60&lt;/strong&gt; and the &lt;strong&gt;MaxCount&lt;/strong&gt; to &lt;strong&gt;5&lt;/strong&gt;, then you have some clients unexpectedly die due to a power failure or become inaccessible due to a network outage, the session will be killed off on the server about 5 minutes later. What it won&#039;t do is kill off the session if the user walks away from their terminal for more than 5 minutes. That&#039;s the problem I&#039;m really trying to solve. 

So far, the best solution I can find for that is to set the &lt;strong&gt;TMOUT&lt;/strong&gt; environment variable in bash, although this only works at the primary shell prompt. If you happen to walk away whilst editing a file in &lt;strong&gt;vi&lt;/strong&gt; or something like that, you again have an effectively infinite idle timeout.

The one thing that you can use &lt;strong&gt;ClientAliveInterval&lt;/strong&gt; to solve is if you have a firewall timing out your NAT session after an annoyingly short idle time. This was the initial problem I set out to solve. When working on 3 screens with 2 or 3 shell sessions open, I would often encounter the problem when working predominantly in one window, the other windows would freeze after about 30 minutes. 

I&#039;d then need to wait about 5 minutes for the client to finally time out and realize that the TCP connection was dead and exit. Setting &lt;strong&gt;ClientAliveInterval&lt;/strong&gt; to a shorter value than the firewall&#039;s timeout value solved that problem by forcing &lt;strong&gt;ClientAlive&lt;/strong&gt; messages to be sent over the connection periodically if there was no other traffic and thereby keeping the connection alive on the firewall. 

With my current &lt;strong&gt;ClientAlive&lt;/strong&gt; {&lt;strong&gt;Interval=30,MaxCount=3&lt;/strong&gt;} settings, my sessions would die after 90 seconds of inactivity if this article was correct. In actuality, they&#039;ll happily stay open for days if I don&#039;t manually end them. If this sounds similar to your problem, then you probably want to set &lt;strong&gt;ClientAliveInterval&lt;/strong&gt; to a relatively short time, like 60 seconds, rather than 1200 or 5000 like the earlier commenters. 

That will get rid of annoying short timeouts due to the network or similar idle timeouts outside of &lt;strong&gt;sshd&lt;/strong&gt; and your shell, but it does create the new problem of user sessions that may never timeout when idle. 

The &lt;strong&gt;TMOUT&lt;/strong&gt; environment variable provides a partial solution, but still has holes. Ideally, I wish there was an option to have sshd enforce an idle timeout based on no console activity, either input or output but so far there doesn&#039;t seem to be an option to get sshd to do that.]]></description>
			<content:encoded><![CDATA[<p>This &#8220;solution&#8221; to set an idle timeout seems quite common on the internet, but it&#8217;s not actually correct. I am looking for a way to get the ssh daemon to enforce an idle timeout for users, which it seems many others are also looking for. Unfortunately, this is not what <strong>ClientAliveInterval</strong> and <strong>ClientAliveMaxCount</strong> do. </p>
<p>If you set <strong>ClientAliveInterval</strong> to a non-zero value, the server will send <strong>ClientAlive</strong> messages over the encrypted channel if it doesn&#8217;t see traffic from the client for that many seconds. This allows the client to respond over the channel that it is still alive and allows the server to clean up sessions where either the network connection has been interrupted or the client has died without gracefully disconnecting. </p>
<p>So if you set the interval to <strong>60</strong> and the <strong>MaxCount</strong> to <strong>5</strong>, then you have some clients unexpectedly die due to a power failure or become inaccessible due to a network outage, the session will be killed off on the server about 5 minutes later. What it won&#8217;t do is kill off the session if the user walks away from their terminal for more than 5 minutes. That&#8217;s the problem I&#8217;m really trying to solve. </p>
<p>So far, the best solution I can find for that is to set the <strong>TMOUT</strong> environment variable in bash, although this only works at the primary shell prompt. If you happen to walk away whilst editing a file in <strong>vi</strong> or something like that, you again have an effectively infinite idle timeout.</p>
<p>The one thing that you can use <strong>ClientAliveInterval</strong> to solve is if you have a firewall timing out your NAT session after an annoyingly short idle time. This was the initial problem I set out to solve. When working on 3 screens with 2 or 3 shell sessions open, I would often encounter the problem when working predominantly in one window, the other windows would freeze after about 30 minutes. </p>
<p>I&#8217;d then need to wait about 5 minutes for the client to finally time out and realize that the TCP connection was dead and exit. Setting <strong>ClientAliveInterval</strong> to a shorter value than the firewall&#8217;s timeout value solved that problem by forcing <strong>ClientAlive</strong> messages to be sent over the connection periodically if there was no other traffic and thereby keeping the connection alive on the firewall. </p>
<p>With my current <strong>ClientAlive</strong> {<strong>Interval=30,MaxCount=3</strong>} settings, my sessions would die after 90 seconds of inactivity if this article was correct. In actuality, they&#8217;ll happily stay open for days if I don&#8217;t manually end them. If this sounds similar to your problem, then you probably want to set <strong>ClientAliveInterval</strong> to a relatively short time, like 60 seconds, rather than 1200 or 5000 like the earlier commenters. </p>
<p>That will get rid of annoying short timeouts due to the network or similar idle timeouts outside of <strong>sshd</strong> and your shell, but it does create the new problem of user sessions that may never timeout when idle. </p>
<p>The <strong>TMOUT</strong> environment variable provides a partial solution, but still has holes. Ideally, I wish there was an option to have sshd enforce an idle timeout based on no console activity, either input or output but so far there doesn&#8217;t seem to be an option to get sshd to do that.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Adam		</title>
		<link>https://www.tecmint.com/increase-ssh-connection-timeout/comment-page-1/#comment-1602444</link>

		<dc:creator><![CDATA[Adam]]></dc:creator>
		<pubDate>Tue, 05 Oct 2021 08:25:08 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=38499#comment-1602444</guid>

					<description><![CDATA[I tried to reload sshd but my terminal still times out. I&#039;ve configured ClientAliveInterval 5000. Do you have any idea?]]></description>
			<content:encoded><![CDATA[<p>I tried to reload sshd but my terminal still times out. I&#8217;ve configured ClientAliveInterval 5000. Do you have any idea?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: anonymous		</title>
		<link>https://www.tecmint.com/increase-ssh-connection-timeout/comment-page-1/#comment-1575889</link>

		<dc:creator><![CDATA[anonymous]]></dc:creator>
		<pubDate>Sat, 28 Aug 2021 19:52:08 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=38499#comment-1575889</guid>

					<description><![CDATA[I did like but you said in the post, but my ssh connection disconnect after about 30 minutes with the below error :

client_loop: send disconnect: Broken pipe

It happened when I try to install along with automatade script and I have no control over my session to execute any command. because the script is progressing. i set &quot;ClientAliveInterval 1200&quot; and &quot;ClientAliveCountMax 3&quot; in sshd_config]]></description>
			<content:encoded><![CDATA[<p>I did like but you said in the post, but my ssh connection disconnect after about 30 minutes with the below error :</p>
<p>client_loop: send disconnect: Broken pipe</p>
<p>It happened when I try to install along with automatade script and I have no control over my session to execute any command. because the script is progressing. i set &#8220;ClientAliveInterval 1200&#8221; and &#8220;ClientAliveCountMax 3&#8221; in sshd_config</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Brian		</title>
		<link>https://www.tecmint.com/increase-ssh-connection-timeout/comment-page-1/#comment-1516859</link>

		<dc:creator><![CDATA[Brian]]></dc:creator>
		<pubDate>Sun, 06 Jun 2021 22:41:51 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=38499#comment-1516859</guid>

					<description><![CDATA[At least in Ubuntu for OpenSSH, it looks like this &quot;&lt;strong&gt;ClientAliveInterval&lt;/strong&gt;&quot; setting was a hack and no longer supported as a connection timeout setting according to this August 2020 post: https://askubuntu.com/a/1265510]]></description>
			<content:encoded><![CDATA[<p>At least in Ubuntu for OpenSSH, it looks like this &#8220;<strong>ClientAliveInterval</strong>&#8221; setting was a hack and no longer supported as a connection timeout setting according to this August 2020 post: <a target="_blank" href="https://askubuntu.com/a/1265510" rel="nofollow ugc">https://askubuntu.com/a/1265510</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Kishor		</title>
		<link>https://www.tecmint.com/increase-ssh-connection-timeout/comment-page-1/#comment-1416239</link>

		<dc:creator><![CDATA[Kishor]]></dc:creator>
		<pubDate>Fri, 15 Jan 2021 12:34:04 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=38499#comment-1416239</guid>

					<description><![CDATA[Hi,

I am looking for a parameter that can handle the server timeout request for an SSH connection. In other words, if a user is trying to establish a connection with an SSH Server (which doesn&#039;t exist), then how long can we keep the connection request alive, using that parameter.

Kindly suggest the same.

Regards]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>I am looking for a parameter that can handle the server timeout request for an SSH connection. In other words, if a user is trying to establish a connection with an SSH Server (which doesn&#8217;t exist), then how long can we keep the connection request alive, using that parameter.</p>
<p>Kindly suggest the same.</p>
<p>Regards</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
