﻿{"id":556,"date":"2011-07-22T10:14:08","date_gmt":"2011-07-22T02:14:08","guid":{"rendered":"http:\/\/nick.workao.org\/?p=556"},"modified":"2011-07-22T10:14:15","modified_gmt":"2011-07-22T02:14:15","slug":"ssh%e8%b6%85%e6%97%b6%e6%96%ad%e5%bc%80%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/nick.txtcc.com\/index.php\/linux\/556","title":{"rendered":"ssh\u8d85\u65f6\u65ad\u5f00\u7684\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p align=\"left\">\u611f\u8c22\u539a\u79ef\u7f51\u7684\u6295\u9012\n\u5f53\u7528SSH Secure Shell\u8fde\u63a5Linux\u65f6\uff0c\u5982\u679c\u51e0\u5206\u949f\u6ca1\u6709\u4efb\u4f55\u64cd\u4f5c\uff0c\u8fde\u63a5\u5c31\u4f1a\u65ad\u5f00\uff0c\u5fc5\u987b\u91cd\u65b0\u767b\u9646\u624d\u884c\uff0c\u6bcf\u6b21\u90fd\u91cd\u590d\u76f8\u540c\u7684\u64cd\u4f5c\uff0c\u5f88\u662f\u70e6\u4eba\uff0c\u672c\u6587\u603b\u7ed3\u4e86\u4e24\u79cd\u89e3\u51b3\u7684\u65b9\u6cd5\u3002<\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\"><strong>\u65b9\u6cd5<\/strong>\n<strong>1<\/strong>\n<strong>\uff1a\u66f4\u6539<\/strong>\n<strong>ssh<\/strong>\n<strong>\u670d\u52a1\u5668\u7684\u914d\u7f6e\u6587\u4ef6<\/strong>\n<strong>\/etc\/ssh\/sshd_config<\/strong><\/p>\n<p>ClientAliveInterval\u6307\u5b9a\u4e86\u670d\u52a1\u5668\u7aef\u5411\u5ba2\u6237\u7aef\u8bf7\u6c42\u6d88\u606f\u7684\u65f6\u95f4\u95f4\u9694, \u9ed8\u8ba4\u662f0\uff0c\u4e0d\u53d1\u9001\u3002\u800cClientAliveInterval 60\u8868\u793a\u6bcf\u5206\u949f\u53d1\u9001\u4e00\u6b21\uff0c\u7136\u540e\u5ba2\u6237\u7aef\u54cd\u5e94\uff0c\u8fd9\u6837\u5c31\u4fdd\u6301\u957f\u8fde\u63a5\u4e86\u3002\u8fd9\u91cc\u6bd4\u8f83\u602a\u7684\u5730\u65b9\u662f\uff1a\u4e0d\u662f\u5ba2\u6237\u7aef\u4e3b\u52a8\u53d1\u8d77\u4fdd\u6301\u8fde\u63a5\u7684\u8bf7\u6c42(\u5982FTerm, CTerm\u7b49),\u800c\u662f\u9700\u8981\u670d\u52a1\u5668\u5148\u4e3b\u52a8\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u81f3\u4e8eClientAliveCountMax\uff0c\u4f7f\u7528\u9ed8\u8ba4\u503c3\u5373\u53ef\u3002ClientAliveCountMax\u8868\u793a\u670d\u52a1\u5668\u53d1\u51fa\u8bf7\u6c42\u540e\u5ba2\u6237\u7aef\u6ca1\u6709\u54cd\u5e94\u7684\u6b21\u6570\u8fbe\u5230\u4e00\u5b9a\u503c\uff0c\u5c31\u81ea\u52a8\u65ad\u5f00\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u5ba2\u6237\u7aef\u4e0d\u4f1a\u4e0d\u54cd\u5e94\u3002<\/p>\n<p align=\"center\"><img decoding=\"async\" src=\"http:\/\/nick.txtcc.com\/wp-content\/uploads\/remote_image\/2011\/07\/0214109Uj.png\" alt=\"\"><\/p>\n<p>&nbsp;<\/p>\n<p><strong>ClientAliveCountMax<\/strong><\/p>\n<p>Sets the number of client alive messages (see below) which may be sent without sshd(8) 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 ses-sion. It is important to note that the use of client alive messages is very different from TCPKeepAlive (below). The client alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The client alive mechanism is valuable when the client or server depend on knowing when a connection has become inactive.The default value is 3. If ClientAliveInterval (see below) is set to 15, and ClientAliveCountMax is left at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds. This option applies to protocol version 2 only.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>ClientAliveInterval<\/strong><\/p>\n<p>Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) 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. This option applies to protocol version 2 only.<\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\">vim \/etc\/ssh\/sshd_config<\/p>\n<p align=\"left\">\u627e\u5230ClientAliveInterval \u53c2\u6570\uff0c\u5982\u679c\u6ca1\u6709\u5c31\u81ea\u5df1\u52a0\u4e00\u884c\u3002<\/p>\n<p align=\"left\">ClientAliveInterval \u53c2\u6570\u7684\u6570\u503c\u662f\u79d2\uff0c\u6bd4\u5982\u4f60\u8bbe\u7f6e\u4e3a540\uff0c\u5c31\u662f9\u5206\u949f.<\/p>\n<p align=\"left\">ClientAliveInterval 540<\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\">\u5bf9\u4e8eClientAliveCountMax<\/p>\n<p align=\"left\">\u6307\u5982\u679c\u53d1\u73b0\u5ba2\u6237\u7aef\u6ca1\u6709\u76f8\u5e94\uff0c\u5219\u5224\u65ad\u4e00\u6b21\u8d85\u65f6\uff0c\u8fd9\u4e2a\u53c2\u6570\u8bbe\u7f6e\u5141\u8bb8\u8d85\u65f6\u7684\u6b21\u6570\uff0c\u6bd4\u598210\u3002<\/p>\n<p align=\"left\">ClientAliveInterval 540<\/p>\n<p align=\"left\">ClientAliveCountMax 10;<\/p>\n<p align=\"left\">\u5219\u4ee3\u8868\u5141\u8bb8\u8d85\u65f6 5400\u79d2 = 90\u5206\u949f\u3002<\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\"><strong>\u65b9\u6cd5<\/strong>\n<strong>2<\/strong>\n<strong>\uff1a\u914d\u7f6e\u5ba2\u6237\u7aef<\/strong>\n<strong> <\/strong><\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\">1 linux\u4e0b\u7684ssh\u547d\u4ee4<\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\">vim \/etc\/ssh\/ssh_config<\/p>\n<p align=\"left\">\u7136\u540e\u627e\u5230\u91cc\u9762\u7684ServerAliveInterval \u53c2\u6570\uff0c\u5982\u679c\u6ca1\u6709\u4f60\u540c\u6837\u81ea\u5df1\u52a0\u4e00\u4e2a\u5c31\u597d\u4e86\u3002\u53c2\u6570\u610f\u4e49\u76f8\u540c\uff0c\u90fd\u662f\u79d2\u6570\uff0c\u6bd4\u59829\u5206\u949f\uff1a<\/p>\n<p align=\"left\">ServerAliveInterval 540<\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\">2 SecureCRT<\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\">\u8bbe\u7f6e\u53cd\u7a7a\u95f2\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n<p align=\"left\"><a href=\"http:\/\/nick.txtcc.com\/wp-content\/uploads\/remote_image\/2011\/07\/021414Raq.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-132\" title=\"securecrt_to\" src=\"http:\/\/nick.txtcc.com\/wp-content\/uploads\/remote_image\/2011\/07\/021414Raq.png\" alt=\"securecrt_to\" width=\"553\" height=\"436\"><\/a><\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\">3 Putty<\/p>\n<p align=\"left\"><\/p>\n<p align=\"left\">\u542f\u7528putty keepalive<\/p>\n<p align=\"left\">putty -> Connection -> Seconds between keepalives ( 0 to turn off )\uff0c\u9ed8\u8ba4\u4e3a0\uff0c\u6539\u4e3a60\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u611f\u8c22\u539a\u79ef\u7f51\u7684\u6295\u9012 \u5f53\u7528SSH Secure Shell\u8fde\u63a5Linux\u65f6\uff0c\u5982\u679c\u51e0\u5206\u949f\u6ca1\u6709\u4efb\u4f55\u64cd\u4f5c\uff0c\u8fde\u63a5\u5c31\u4f1a\u65ad\u5f00\uff0c\u5fc5\u987b\u91cd\u65b0\u767b\u9646\u624d\u884c\uff0c\u6bcf\u6b21\u90fd\u91cd\u590d\u76f8\u540c\u7684\u64cd\u4f5c\uff0c\u5f88\u662f\u70e6\u4eba\uff0c\u672c\u6587\u603b\u7ed3\u4e86\u4e24\u79cd\u89e3\u51b3\u7684\u65b9\u6cd5\u3002 \u65b9\u6cd5 1 \uff1a&#46;&#46;&#46;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[307],"class_list":["post-556","post","type-post","status-publish","format-standard","hentry","category-linux","tag-ssh"],"_links":{"self":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":2,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/556\/revisions"}],"predecessor-version":[{"id":560,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/556\/revisions\/560"}],"wp:attachment":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}