{"id":444,"date":"2021-01-17T17:09:48","date_gmt":"2021-01-17T15:09:48","guid":{"rendered":"https:\/\/www.codefraction.com\/?p=444"},"modified":"2021-08-19T14:10:23","modified_gmt":"2021-08-19T12:10:23","slug":"prevent-ssh-session-to-a-server-from-disconnecting","status":"publish","type":"post","link":"https:\/\/www.codefraction.com\/index.php\/2021\/01\/17\/prevent-ssh-session-to-a-server-from-disconnecting\/","title":{"rendered":"Prevent SSH session to a server from disconnecting"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"444\" class=\"elementor elementor-444\" data-elementor-settings=\"{&quot;ha_cmc_init_switcher&quot;:&quot;no&quot;}\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-22b84131 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"22b84131\" data-element_type=\"section\" data-settings=\"{&quot;_ha_eqh_enable&quot;:false}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-narrow\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4478757\" data-id=\"4478757\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0421967 elementor-widget elementor-widget-theme-post-title elementor-page-title elementor-widget-heading\" data-id=\"0421967\" data-element_type=\"widget\" data-widget_type=\"theme-post-title.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h1 class=\"elementor-heading-title elementor-size-default\">Prevent SSH session to a server from disconnecting<\/h1>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f311992 elementor-align-left elementor-widget elementor-widget-global elementor-global-471 elementor-widget-post-info\" data-id=\"f311992\" data-element_type=\"widget\" data-widget_type=\"post-info.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ul class=\"elementor-inline-items elementor-icon-list-items elementor-post-info\">\n\t\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item elementor-repeater-item-a9d1b46 elementor-inline-item\" itemprop=\"datePublished\">\n\t\t\t\t\t\t<a href=\"https:\/\/www.codefraction.com\/index.php\/2021\/01\/17\/\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-icon\">\n\t\t\t\t\t\t\t\t<i aria-hidden=\"true\" class=\"fas fa-calendar\"><\/i>\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text elementor-post-info__item elementor-post-info__item--type-date\">\n\t\t\t\t\t\t\t\t\t\t<time>January 17, 2021<\/time>\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t<\/li>\n\t\t\t\t<li class=\"elementor-icon-list-item elementor-repeater-item-8fee4f0 elementor-inline-item\" itemprop=\"about\">\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-icon\">\n\t\t\t\t\t\t\t\t<i aria-hidden=\"true\" class=\"fas fa-tags\"><\/i>\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text elementor-post-info__item elementor-post-info__item--type-terms\">\n\t\t\t\t\t\t\t<span class=\"elementor-post-info__item-prefix\">Tags: <\/span>\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-post-info__terms-list\">\n\t\t\t\t<a href=\"https:\/\/www.codefraction.com\/index.php\/tag\/server\/\" class=\"elementor-post-info__terms-list-item\">Server<\/a>, <a href=\"https:\/\/www.codefraction.com\/index.php\/tag\/ssh\/\" class=\"elementor-post-info__terms-list-item\">SSH<\/a>, <a href=\"https:\/\/www.codefraction.com\/index.php\/tag\/terminal\/\" class=\"elementor-post-info__terms-list-item\">Terminal<\/a>\t\t\t\t<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t<\/ul>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b82449d elementor-widget elementor-widget-text-editor\" data-id=\"b82449d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>If you need to connect for example to a web server by using SSH, you might have encountered that sometimes the SSH session becomes unresponsive, because the connection has timed out and disconnected. This migth happen, if you haven&#8217;t typed anything in the terminal in a while (for example you reading some documentation at the same time). There&#8217;s an easy fix for that. We need to add the following to \/etc\/ssh\/ssh_config file:<\/p><p><br><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9ff3084 elementor-widget elementor-widget-text-editor\" data-id=\"9ff3084\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div><em># Keep connection alive by sending a packet every 10 seconds<br \/><\/em><\/div>\n<div><em>ServerAliveInterval 10<\/em><\/div>\n<p>\u00a0<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-98c0ff6 elementor-widget elementor-widget-spacer\" data-id=\"98c0ff6\" data-element_type=\"widget\" data-widget_type=\"spacer.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-spacer\">\n\t\t\t<div class=\"elementor-spacer-inner\"><\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-760913c elementor-widget elementor-widget-heading\" data-id=\"760913c\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Sources:<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bef651b elementor-widget elementor-widget-text-editor\" data-id=\"bef651b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>I found the following thread on StackExchange useful for fixing this problem.<br><br><a href=\"https:\/\/apple.stackexchange.com\/questions\/36690\/how-can-i-prevent-an-ssh-session-from-hanging-in-os-x-terminal\" target=\"_blank\">https:\/\/apple.stackexchange.com\/questions\/36690\/how-can-i-prevent-an-ssh-session-from-hanging-in-os-x-terminal<\/a><\/p>\n\n<p><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1c24402 elementor-widget elementor-widget-spacer\" data-id=\"1c24402\" data-element_type=\"widget\" data-widget_type=\"spacer.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-spacer\">\n\t\t\t<div class=\"elementor-spacer-inner\"><\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>If you need to connect for example to a web server by using SSH, you might have encountered that sometimes the SSH session becomes unresponsive, because the connection has timed out and disconnected. This migth happen, if you haven't typed anything in the terminal in a while (for example you reading some documentation at the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_header_footer","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[22,21,11],"class_list":["post-444","post","type-post","status-publish","format-standard","hentry","category-linux","tag-server","tag-ssh","tag-terminal"],"_links":{"self":[{"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":29,"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/posts\/444\/revisions"}],"predecessor-version":[{"id":986,"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/posts\/444\/revisions\/986"}],"wp:attachment":[{"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/media?parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/categories?post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codefraction.com\/index.php\/wp-json\/wp\/v2\/tags?post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}