{"id":3286,"date":"2017-01-26T12:11:40","date_gmt":"2017-01-26T12:11:40","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=3286"},"modified":"2017-01-26T12:11:40","modified_gmt":"2017-01-26T12:11:40","slug":"can-keep-ssh-sessions-freezing-centos-6","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2017\/01\/26\/can-keep-ssh-sessions-freezing-centos-6\/","title":{"rendered":"How can I keep my SSH sessions Alive"},"content":{"rendered":"<p>Here is how to keep your ssh session from freezing and how to keep ssh alive.<\/p>\n<p>Edit your ssh config file. Change to the following variables<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># nano \/etc\/ssh\/sshd_config<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">TCPKeepAlive yes\nClientAliveInterval 60\nClientAliveCountMax 10000\n<\/pre>\n<p>Then, restart ssh<\/p>\n<p>On CentOS:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># service sshd restart\nStopping sshd:                                             &#x5B;  OK  ]\nStarting sshd:                                             &#x5B;  OK  ]\n<\/pre>\n<ul>\n<li>TCPKeepAlive &#8211; is there to ensure that certain firewalls don&#8217;t drop idle connections.<\/li>\n<li>ClientAliveInterval &#8211; the server will wait 60 seconds before sending a null packet to the client to keep the connection alive.<\/li>\n<li>ClientAliveCountMax &#8211; server will send alive messages to the client even though it has not received any message back from the client.<\/li>\n<\/ul>\n<p>Using Putty Settings<\/p>\n<ol>\n<li>Start PuTTY.<\/li>\n<li>Load pone of your saved sessions.<\/li>\n<li>In the Category pane, click Connection.<\/li>\n<li>Look for &#8221; Sending of null packets to keep session active&#8221;.<\/li>\n<li>In the Seconds between keepalives (0 to turn off), type 300. (With this configuration, PuTTY sends a packet to the server every 300 seconds -5 minutes &#8211; to keep the connection alive.<\/li>\n<li>In the Category pane, click Session.<\/li>\n<li>Click Save.<\/li>\n<li>Connect to your account and monitor the connection. If it still drops, gradually decrease the keepalive interval until the connection is stable.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2017\/01\/keepalive.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4510\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2017\/01\/keepalive.png\" alt=\"\" width=\"482\" height=\"464\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/keepalive.png 482w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/keepalive-300x289.png 300w\" sizes=\"auto, (max-width: 482px) 100vw, 482px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is how to keep your ssh session from freezing and how to keep ssh alive. Edit your ssh config file. Change to the following variables # nano \/etc\/ssh\/sshd_config TCPKeepAlive yes ClientAliveInterval 60 ClientAliveCountMax 10000 Then, restart ssh On CentOS: # service sshd restart Stopping sshd: &#x5B; OK ] Starting sshd: &#x5B; OK ] TCPKeepAlive &#8230; <a title=\"How can I keep my SSH sessions Alive\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2017\/01\/26\/can-keep-ssh-sessions-freezing-centos-6\/\" aria-label=\"Read more about How can I keep my SSH sessions Alive\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110],"tags":[],"class_list":["post-3286","post","type-post","status-publish","format-standard","hentry","category-ssh"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=3286"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3286\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=3286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=3286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=3286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}