{"id":55736,"date":"2025-08-14T07:37:17","date_gmt":"2025-08-13T23:37:17","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/55736.html"},"modified":"2025-08-14T07:37:17","modified_gmt":"2025-08-13T23:37:17","slug":"horain%e4%ba%91-ssh-%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/55736.html","title":{"rendered":"HoRain\u4e91--SSH \u670d\u52a1\u5668"},"content":{"rendered":"<\/p>\n<p style=\"text-align:center\">\u00a0\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"70\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250813233716-689d21ac0155b.jpg\" width=\"70\" \/><\/p>\n<p style=\"text-align:center\">&#x1f3ac; HoRain \u4e91\u5c0f\u52a9\u624b&#xff1a;\u4e2a\u4eba\u4e3b\u9875<\/p>\n<p style=\"text-align:center\">\u26fa\ufe0f\u751f\u6d3b\u7684\u7406\u60f3&#xff0c;\u5c31\u662f\u4e3a\u4e86\u7406\u60f3\u7684\u751f\u6d3b!<\/p>\n<hr \/>\n<h4 id=\"%E2%9B%B3%EF%B8%8F%20%E6%8E%A8%E8%8D%90\">\u26f3\ufe0f \u63a8\u8350<\/h4>\n<p>\u524d\u4e9b\u5929\u53d1\u73b0\u4e86\u4e00\u4e2a\u8d85\u68d2\u7684\u670d\u52a1\u5668\u8d2d\u4e70\u7f51\u7ad9&#xff0c;\u6027\u4ef7\u6bd4\u8d85\u9ad8&#xff0c;\u5927\u5185\u5b58\u8d85\u5212\u7b97&#xff01;\u5fcd\u4e0d\u4f4f\u5206\u4eab\u4e00\u4e0b\u7ed9\u5927\u5bb6\u3002\u70b9\u51fb\u8df3\u8f6c\u5230\u7f51\u7ad9\u3002<\/p>\n<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E2%9B%B3%EF%B8%8F%20%E6%8E%A8%E8%8D%90-toc\" style=\"margin-left:80px\">\u26f3\ufe0f \u63a8\u8350<\/p>\n<p id=\"%E7%AE%80%E4%BB%8B-toc\" style=\"margin-left:40px\">\u7b80\u4ecb<\/p>\n<p id=\"sshd%20%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:40px\">sshd \u914d\u7f6e\u6587\u4ef6<\/p>\n<p id=\"sshd%20%E5%AF%86%E9%92%A5-toc\" style=\"margin-left:40px\">sshd \u5bc6\u94a5<\/p>\n<p id=\"sshd%20%E9%85%8D%E7%BD%AE%E9%A1%B9-toc\" style=\"margin-left:40px\">sshd \u914d\u7f6e\u9879<\/p>\n<p id=\"sshd%20%E7%9A%84%E5%91%BD%E4%BB%A4%E8%A1%8C%E9%85%8D%E7%BD%AE%E9%A1%B9-toc\" style=\"margin-left:40px\">sshd \u7684\u547d\u4ee4\u884c\u914d\u7f6e\u9879<\/p>\n<hr id=\"hr-toc\" \/>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"540\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250813233716-689d21ac6186c.png\" width=\"960\" \/><\/p>\n<h3 id=\"%E7%AE%80%E4%BB%8B\">\u7b80\u4ecb<\/h3>\n<p>SSH \u7684\u67b6\u6784\u662f\u670d\u52a1\u5668\/\u5ba2\u6237\u7aef\u6a21\u5f0f&#xff0c;\u4e24\u7aef\u8fd0\u884c\u7684\u8f6f\u4ef6\u662f\u4e0d\u4e00\u6837\u7684\u3002OpenSSH \u7684\u5ba2\u6237\u7aef\u8f6f\u4ef6\u662f ssh&#xff0c;\u670d\u52a1\u5668\u8f6f\u4ef6\u662f sshd\u3002\u672c\u7ae0\u4ecb\u7ecd sshd \u7684\u5404\u79cd\u77e5\u8bc6\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709\u5b89\u88c5 sshd&#xff0c;\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u5b89\u88c5\u3002<\/p>\n<p># Debian<\/p>\n<p>$ sudo aptitude install openssh-server\u00a0<\/p>\n<p># Red Hat\u00a0<\/p>\n<p>$ sudo yum install openssh-server<\/p>\n<p>\u4e00\u822c\u6765\u8bf4&#xff0c;sshd \u5b89\u88c5\u540e\u4f1a\u8ddf\u7740\u7cfb\u7edf\u4e00\u8d77\u542f\u52a8\u3002\u5982\u679c\u5f53\u524d sshd \u6ca1\u6709\u542f\u52a8&#xff0c;\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u542f\u52a8\u3002<\/p>\n<p>$ sshd  <\/p>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u8fd0\u884c\u540e&#xff0c;\u5982\u679c\u63d0\u793a\u201csshd re-exec requires execution with an absolute path\u201d&#xff0c;\u5c31\u9700\u8981\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u6765\u542f\u52a8\u3002\u8fd9\u662f\u4e3a\u4e86\u9632\u6b62\u6709\u4eba\u51fa\u4e8e\u5404\u79cd\u76ee\u7684&#xff0c;\u653e\u7f6e\u540c\u540d\u8f6f\u4ef6\u5728$PATH\u53d8\u91cf\u6307\u5411\u7684\u76ee\u5f55\u4e2d&#xff0c;\u4ee3\u66ff\u771f\u6b63\u7684 sshd\u3002<\/p>\n<p># Centos\u3001Ubuntu\u3001OS X $ \/usr\/sbin\/sshd  <\/p>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u8fd0\u884c\u4ee5\u540e&#xff0c;sshd \u81ea\u52a8\u8fdb\u5165\u540e\u53f0&#xff0c;\u6240\u4ee5\u547d\u4ee4\u540e\u9762\u4e0d\u9700\u8981\u52a0\u4e0a&amp;\u3002<\/p>\n<p>\u9664\u4e86\u76f4\u63a5\u8fd0\u884c\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u4e5f\u53ef\u4ee5\u901a\u8fc7 Systemd \u542f\u52a8 sshd\u3002<\/p>\n<p># \u542f\u52a8\u00a0<\/p>\n<p>$ sudo systemctl start sshd.service\u00a0<\/p>\n<p># \u505c\u6b62\u00a0<\/p>\n<p>$ sudo systemctl stop sshd.service\u00a0<\/p>\n<p># \u91cd\u542f\u00a0<\/p>\n<p>$ sudo systemctl restart sshd.service<\/p>\n<p>\u4e0b\u9762\u7684\u547d\u4ee4\u8ba9 sshd \u5728\u8ba1\u7b97\u673a\u4e0b\u6b21\u542f\u52a8\u65f6\u81ea\u52a8\u8fd0\u884c\u3002<\/p>\n<p>$ sudo systemctl enable sshd.service  <\/p>\n<h3 id=\"sshd%20%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6\">sshd \u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>sshd \u7684\u914d\u7f6e\u6587\u4ef6\u5728\/etc\/ssh\u76ee\u5f55&#xff0c;\u4e3b\u914d\u7f6e\u6587\u4ef6\u662fsshd_config&#xff0c;\u6b64\u5916\u8fd8\u6709\u4e00\u4e9b\u5b89\u88c5\u65f6\u751f\u6210\u7684\u5bc6\u94a5\u3002<\/p>\n<ul>\n<li>\/etc\/ssh\/sshd_config&#xff1a;\u914d\u7f6e\u6587\u4ef6<\/li>\n<li>\/etc\/ssh\/ssh_host_ecdsa_key&#xff1a;ECDSA \u79c1\u94a5\u3002<\/li>\n<li>\/etc\/ssh\/ssh_host_ecdsa_key.pub&#xff1a;ECDSA \u516c\u94a5\u3002<\/li>\n<li>\/etc\/ssh\/ssh_host_key&#xff1a;\u7528\u4e8e SSH 1 \u534f\u8bae\u7248\u672c\u7684 RSA \u79c1\u94a5\u3002<\/li>\n<li>\/etc\/ssh\/ssh_host_key.pub&#xff1a;\u7528\u4e8e SSH 1 \u534f\u8bae\u7248\u672c\u7684 RSA \u516c\u94a5\u3002<\/li>\n<li>\/etc\/ssh\/ssh_host_rsa_key&#xff1a;\u7528\u4e8e SSH 2 \u534f\u8bae\u7248\u672c\u7684 RSA \u79c1\u94a5\u3002<\/li>\n<li>\/etc\/ssh\/ssh_host_rsa_key.pub&#xff1a;\u7528\u4e8e SSH 2 \u534f\u8bae\u7248\u672c\u7684 RSA \u516c\u94a5\u3002<\/li>\n<li>\/etc\/pam.d\/sshd&#xff1a;PAM \u914d\u7f6e\u6587\u4ef6\u3002<\/li>\n<\/ul>\n<p>\u6ce8\u610f&#xff0c;\u5982\u679c\u91cd\u88c5 sshd&#xff0c;\u4e0a\u9762\u8fd9\u4e9b\u5bc6\u94a5\u90fd\u4f1a\u91cd\u65b0\u751f\u6210&#xff0c;\u5bfc\u81f4\u5ba2\u6237\u7aef\u91cd\u65b0\u8fde\u63a5 ssh \u670d\u52a1\u5668\u65f6&#xff0c;\u4f1a\u8df3\u51fa\u8b66\u544a&#xff0c;\u62d2\u7edd\u8fde\u63a5\u3002\u4e3a\u4e86\u907f\u514d\u8fd9\u79cd\u60c5\u51b5&#xff0c;\u53ef\u4ee5\u5728\u91cd\u88c5 sshd \u65f6&#xff0c;\u5148\u5907\u4efd\/etc\/ssh\u76ee\u5f55&#xff0c;\u91cd\u88c5\u540e\u518d\u6062\u590d\u8fd9\u4e2a\u76ee\u5f55\u3002<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6sshd_config\u7684\u683c\u5f0f\u662f&#xff0c;\u6bcf\u4e2a\u547d\u4ee4\u5360\u636e\u4e00\u884c\u3002\u6bcf\u884c\u90fd\u662f\u914d\u7f6e\u9879\u548c\u5bf9\u5e94\u7684\u503c&#xff0c;\u914d\u7f6e\u9879\u7684\u5927\u5c0f\u5199\u4e0d\u654f\u611f&#xff0c;\u4e0e\u503c\u4e4b\u95f4\u4f7f\u7528\u7a7a\u683c\u5206\u9694\u3002<\/p>\n<p>Port 2034  <\/p>\n<p>\u4e0a\u9762\u7684\u914d\u7f6e\u547d\u4ee4\u6307\u5b9a&#xff0c;\u914d\u7f6e\u9879Port\u7684\u503c\u662f2034\u3002Port\u5199\u6210port\u4e5f\u53ef\u3002<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u8fd8\u6709\u53e6\u4e00\u79cd\u683c\u5f0f&#xff0c;\u5c31\u662f\u914d\u7f6e\u9879\u4e0e\u503c\u4e4b\u95f4\u6709\u4e00\u4e2a\u7b49\u53f7&#xff0c;\u7b49\u53f7\u524d\u540e\u7684\u7a7a\u683c\u53ef\u9009\u3002<\/p>\n<p>Port &#061; 2034  <\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u91cc\u9762&#xff0c;#\u5f00\u5934\u7684\u884c\u8868\u793a\u6ce8\u91ca\u3002<\/p>\n<p># \u8fd9\u662f\u4e00\u884c\u6ce8\u91ca  <\/p>\n<p>\u6ce8\u610f&#xff0c;\u6ce8\u91ca\u53ea\u80fd\u653e\u5728\u4e00\u884c\u7684\u5f00\u5934&#xff0c;\u4e0d\u80fd\u653e\u5728\u4e00\u884c\u7684\u7ed3\u5c3e\u3002<\/p>\n<p>Port 2034 # \u6b64\u5904\u4e0d\u5141\u8bb8\u6ce8\u91ca  <\/p>\n<p>\u4e0a\u9762\u7684\u5199\u6cd5\u662f\u9519\u8bef\u7684\u3002<\/p>\n<p>\u53e6\u5916&#xff0c;\u7a7a\u884c\u7b49\u540c\u4e8e\u6ce8\u91ca\u3002<\/p>\n<p>sshd \u542f\u52a8\u65f6\u4f1a\u81ea\u52a8\u8bfb\u53d6\u9ed8\u8ba4\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u5982\u679c\u5e0c\u671b\u4f7f\u7528\u5176\u4ed6\u7684\u914d\u7f6e\u6587\u4ef6&#xff0c;\u53ef\u4ee5\u7528 sshd \u547d\u4ee4\u7684-f\u53c2\u6570\u6307\u5b9a\u3002<\/p>\n<p>$ sshd -f \/usr\/local\/ssh\/my_config  <\/p>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u6307\u5b9a sshd \u4f7f\u7528\u53e6\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6my_config\u3002<\/p>\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u4ee5\u540e&#xff0c;\u53ef\u4ee5\u7528 sshd \u547d\u4ee4\u7684-t&#xff08;test&#xff09;\u68c0\u67e5\u6709\u6ca1\u6709\u8bed\u6cd5\u9519\u8bef\u3002<\/p>\n<p>$ sshd -t  <\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u4ee5\u540e&#xff0c;\u5e76\u4e0d\u4f1a\u81ea\u52a8\u751f\u6548&#xff0c;\u5fc5\u987b\u91cd\u65b0\u542f\u52a8 sshd\u3002<\/p>\n<p>$ sudo systemctl restart sshd.service  <\/p>\n<h3 id=\"sshd%20%E5%AF%86%E9%92%A5\">sshd \u5bc6\u94a5<\/h3>\n<p>sshd \u6709\u81ea\u5df1\u7684\u4e00\u5bf9\u6216\u591a\u5bf9\u5bc6\u94a5\u3002\u5b83\u4f7f\u7528\u5bc6\u94a5\u5411\u5ba2\u6237\u7aef\u8bc1\u660e\u81ea\u5df1\u7684\u8eab\u4efd\u3002\u6240\u6709\u5bc6\u94a5\u90fd\u662f\u516c\u94a5\u548c\u79c1\u94a5\u6210\u5bf9\u51fa\u73b0&#xff0c;\u516c\u94a5\u7684\u6587\u4ef6\u540d\u4e00\u822c\u662f\u79c1\u94a5\u6587\u4ef6\u540d\u52a0\u4e0a\u540e\u7f00.pub\u3002<\/p>\n<p>DSA \u683c\u5f0f\u7684\u5bc6\u94a5\u6587\u4ef6\u9ed8\u8ba4\u4e3a\/etc\/ssh\/ssh_host_dsa_key&#xff08;\u516c\u94a5\u4e3assh_host_dsa_key.pub&#xff09;&#xff0c;RSA \u683c\u5f0f\u7684\u5bc6\u94a5\u4e3a\/etc\/ssh\/ssh_host_rsa_key&#xff08;\u516c\u94a5\u4e3assh_host_rsa_key.pub&#xff09;\u3002\u5982\u679c\u9700\u8981\u652f\u6301 SSH 1 \u534f\u8bae&#xff0c;\u5219\u5fc5\u987b\u6709\u5bc6\u94a5\/etc\/ssh\/ssh_host_key\u3002<\/p>\n<p>\u5982\u679c\u5bc6\u94a5\u4e0d\u662f\u9ed8\u8ba4\u6587\u4ef6&#xff0c;\u90a3\u4e48\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6sshd_config\u7684HostKey\u914d\u7f6e\u9879\u6307\u5b9a\u3002\u9ed8\u8ba4\u5bc6\u94a5\u7684HostKey\u8bbe\u7f6e\u5982\u4e0b\u3002<\/p>\n<\/p>\n<p># HostKey for protocol version 1<br \/>\n# HostKey \/etc\/ssh\/ssh_host_key<br \/>\n# HostKeys for protocol version 2<br \/>\n# HostKey \/etc\/ssh\/ssh_host_rsa_key<br \/>\n# HostKey \/etc\/ssh\/ssh_host_dsa_ke<\/p>\n<p>\u4e0a\u9762\u547d\u4ee4\u524d\u9762\u7684#\u8868\u793a\u8fd9\u4e9b\u884c\u90fd\u662f\u6ce8\u91ca&#xff0c;\u56e0\u4e3a\u8fd9\u662f\u9ed8\u8ba4\u503c&#xff0c;\u6709\u6ca1\u6709\u8fd9\u51e0\u884c\u90fd\u4e00\u6837\u3002<\/p>\n<p>\u5982\u679c\u8981\u4fee\u6539\u5bc6\u94a5&#xff0c;\u5c31\u8981\u53bb\u6389\u884c\u9996\u7684#&#xff0c;\u6307\u5b9a\u5176\u4ed6\u5bc6\u94a5\u3002<\/p>\n<p>HostKey \/usr\/local\/ssh\/my_dsa_key<br \/>\nHostKey \/usr\/local\/ssh\/my_rsa_key<br \/>\nHostKey \/usr\/local\/ssh\/my_old_ssh1_key  <\/p>\n<h3 id=\"sshd%20%E9%85%8D%E7%BD%AE%E9%A1%B9\">sshd \u914d\u7f6e\u9879<\/h3>\n<p>\u4ee5\u4e0b\u662f\/etc\/ssh\/sshd_config\u6587\u4ef6\u91cc\u9762\u7684\u914d\u7f6e\u9879\u3002<\/p>\n<p>AcceptEnv<\/p>\n<p>AcceptEnv\u6307\u5b9a\u5141\u8bb8\u63a5\u53d7\u5ba2\u6237\u7aef\u901a\u8fc7SendEnv\u547d\u4ee4\u53d1\u6765\u7684\u54ea\u4e9b\u73af\u5883\u53d8\u91cf&#xff0c;\u5373\u5141\u8bb8\u5ba2\u6237\u7aef\u8bbe\u7f6e\u670d\u52a1\u5668\u7684\u73af\u5883\u53d8\u91cf\u6e05\u5355&#xff0c;\u53d8\u91cf\u540d\u4e4b\u95f4\u4f7f\u7528\u7a7a\u683c\u5206\u9694&#xff08;AcceptEnv PATH TERM&#xff09;\u3002<\/p>\n<p>AllowGroups<\/p>\n<p>AllowGroups\u6307\u5b9a\u5141\u8bb8\u767b\u5f55\u7684\u7528\u6237\u7ec4&#xff08;AllowGroups groupName&#xff0c;\u591a\u4e2a\u7ec4\u4e4b\u95f4\u7528\u7a7a\u683c\u5206\u9694\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u8be5\u9879&#xff0c;\u5219\u5141\u8bb8\u6240\u6709\u7528\u6237\u7ec4\u767b\u5f55\u3002<\/p>\n<p>AllowUsers<\/p>\n<p>AllowUsers\u6307\u5b9a\u5141\u8bb8\u767b\u5f55\u7684\u7528\u6237&#xff0c;\u7528\u6237\u540d\u4e4b\u95f4\u4f7f\u7528\u7a7a\u683c\u5206\u9694&#xff08;AllowUsers user1 user2&#xff09;&#xff0c;\u4e5f\u53ef\u4ee5\u4f7f\u7528\u591a\u884cAllowUsers\u547d\u4ee4\u6307\u5b9a&#xff0c;\u7528\u6237\u540d\u652f\u6301\u4f7f\u7528\u901a\u914d\u7b26\u3002\u5982\u679c\u4e0d\u4f7f\u7528\u8be5\u9879&#xff0c;\u5219\u5141\u8bb8\u6240\u6709\u7528\u6237\u767b\u5f55\u3002\u8be5\u9879\u4e5f\u53ef\u4ee5\u4f7f\u7528\u7528\u6237\u540d&#064;\u57df\u540d\u7684\u683c\u5f0f&#xff08;\u6bd4\u5982AllowUsers\u00a0jones&#064;example.com&#xff09;\u3002<\/p>\n<p>AllowTcpForwarding<\/p>\n<p>AllowTcpForwarding\u6307\u5b9a\u662f\u5426\u5141\u8bb8\u7aef\u53e3\u8f6c\u53d1&#xff0c;\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;AllowTcpForwarding yes&#xff09;&#xff0c;local\u8868\u793a\u53ea\u5141\u8bb8\u672c\u5730\u7aef\u53e3\u8f6c\u53d1&#xff0c;remote\u8868\u793a\u53ea\u5141\u8bb8\u8fdc\u7a0b\u7aef\u53e3\u8f6c\u53d1\u3002<\/p>\n<p>AuthorizedKeysFile<\/p>\n<p>AuthorizedKeysFile\u6307\u5b9a\u50a8\u5b58\u7528\u6237\u516c\u94a5\u7684\u76ee\u5f55&#xff0c;\u9ed8\u8ba4\u662f\u7528\u6237\u4e3b\u76ee\u5f55\u7684ssh\/authorized_keys\u76ee\u5f55&#xff08;AuthorizedKeysFile .ssh\/authorized_keys&#xff09;\u3002<\/p>\n<p>Banner<\/p>\n<p>Banner\u6307\u5b9a\u7528\u6237\u767b\u5f55\u540e&#xff0c;sshd \u5411\u5176\u5c55\u793a\u7684\u4fe1\u606f\u6587\u4ef6&#xff08;Banner \/usr\/local\/etc\/warning.txt&#xff09;&#xff0c;\u9ed8\u8ba4\u4e0d\u5c55\u793a\u4efb\u4f55\u5185\u5bb9\u3002<\/p>\n<p>ChallengeResponseAuthentication<\/p>\n<p>ChallengeResponseAuthentication\u6307\u5b9a\u662f\u5426\u4f7f\u7528\u201c\u952e\u76d8\u4ea4\u4e92\u201d\u8eab\u4efd\u9a8c\u8bc1\u65b9\u6848&#xff0c;\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;ChallengeResponseAuthentication yes&#xff09;\u3002<\/p>\n<p>\u4ece\u7406\u8bba\u4e0a\u8bb2&#xff0c;\u201c\u952e\u76d8\u4ea4\u4e92\u201d\u8eab\u4efd\u9a8c\u8bc1\u65b9\u6848\u53ef\u4ee5\u5411\u7528\u6237\u8be2\u95ee\u591a\u91cd\u95ee\u9898&#xff0c;\u4f46\u662f\u5b9e\u8df5\u4e2d&#xff0c;\u901a\u5e38\u4ec5\u8be2\u95ee\u7528\u6237\u5bc6\u7801\u3002\u5982\u679c\u8981\u5b8c\u5168\u7981\u7528\u57fa\u4e8e\u5bc6\u7801\u7684\u8eab\u4efd\u9a8c\u8bc1&#xff0c;\u8bf7\u5c06PasswordAuthentication\u548cChallengeResponseAuthentication\u90fd\u8bbe\u7f6e\u4e3ano\u3002<\/p>\n<p>Ciphers<\/p>\n<p>Ciphers\u6307\u5b9a sshd \u53ef\u4ee5\u63a5\u53d7\u7684\u52a0\u5bc6\u7b97\u6cd5&#xff08;Ciphers 3des-cbc&#xff09;&#xff0c;\u591a\u4e2a\u7b97\u6cd5\u4e4b\u95f4\u4f7f\u7528\u9017\u53f7\u5206\u9694\u3002<\/p>\n<p>ClientAliveCountMax<\/p>\n<p>ClientAliveCountMax\u6307\u5b9a\u5efa\u7acb\u8fde\u63a5\u540e&#xff0c;\u5ba2\u6237\u7aef\u5931\u53bb\u54cd\u5e94\u65f6&#xff0c;\u670d\u52a1\u5668\u5c1d\u8bd5\u8fde\u63a5\u7684\u6b21\u6570&#xff08;ClientAliveCountMax 8&#xff09;\u3002<\/p>\n<p>ClientAliveInterval<\/p>\n<p>ClientAliveInterval\u6307\u5b9a\u5141\u8bb8\u5ba2\u6237\u7aef\u53d1\u5446\u7684\u65f6\u95f4&#xff0c;\u5355\u4f4d\u4e3a\u79d2&#xff08;ClientAliveInterval 180&#xff09;\u3002\u5982\u679c\u8fd9\u6bb5\u65f6\u95f4\u91cc\u9762&#xff0c;\u5ba2\u6237\u7aef\u6ca1\u6709\u53d1\u9001\u4efb\u4f55\u4fe1\u53f7&#xff0c;SSH \u8fde\u63a5\u5c06\u5173\u95ed\u3002<\/p>\n<p>Compression<\/p>\n<p>Compression\u6307\u5b9a\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u662f\u5426\u538b\u7f29\u3002\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;Compression yes&#xff09;<\/p>\n<p>DenyGroups<\/p>\n<p>DenyGroups\u6307\u5b9a\u4e0d\u5141\u8bb8\u767b\u5f55\u7684\u7528\u6237\u7ec4&#xff08;DenyGroups groupName&#xff09;\u3002<\/p>\n<p>DenyUsers<\/p>\n<p>DenyUsers\u6307\u5b9a\u4e0d\u5141\u8bb8\u767b\u5f55\u7684\u7528\u6237&#xff08;DenyUsers user1&#xff09;&#xff0c;\u7528\u6237\u540d\u4e4b\u95f4\u4f7f\u7528\u7a7a\u683c\u5206\u9694&#xff0c;\u4e5f\u53ef\u4ee5\u4f7f\u7528\u591a\u884cDenyUsers\u547d\u4ee4\u6307\u5b9a\u3002<\/p>\n<p>FascistLogging<\/p>\n<p>SSH 1 \u7248\u672c\u4e13\u7528&#xff0c;\u6307\u5b9a\u65e5\u5fd7\u8f93\u51fa\u5168\u90e8 Debug \u4fe1\u606f&#xff08;FascistLogging yes&#xff09;\u3002<\/p>\n<p>HostKey<\/p>\n<p>HostKey\u6307\u5b9a sshd \u670d\u52a1\u5668\u7684\u5bc6\u94a5&#xff0c;\u8be6\u89c1\u524d\u6587\u3002<\/p>\n<p>KeyRegenerationInterval<\/p>\n<p>KeyRegenerationInterval\u6307\u5b9a SSH 1 \u7248\u672c\u7684\u5bc6\u94a5\u91cd\u65b0\u751f\u6210\u65f6\u95f4\u95f4\u9694&#xff0c;\u5355\u4f4d\u4e3a\u79d2&#xff0c;\u9ed8\u8ba4\u662f3600\u79d2&#xff08;KeyRegenerationInterval 3600&#xff09;\u3002<\/p>\n<p>ListenAddress<\/p>\n<p>ListenAddress\u6307\u5b9a sshd \u76d1\u542c\u7684\u672c\u673a IP \u5730\u5740&#xff0c;\u5373 sshd \u542f\u7528\u7684 IP \u5730\u5740&#xff0c;\u9ed8\u8ba4\u662f 0.0.0.0&#xff08;ListenAddress 0.0.0.0&#xff09;\u8868\u793a\u5728\u672c\u673a\u6240\u6709\u7f51\u7edc\u63a5\u53e3\u542f\u7528\u3002\u53ef\u4ee5\u6539\u6210\u53ea\u5728\u67d0\u4e2a\u7f51\u7edc\u63a5\u53e3\u542f\u7528&#xff08;\u6bd4\u5982ListenAddress 192.168.10.23&#xff09;&#xff0c;\u4e5f\u53ef\u4ee5\u6307\u5b9a\u67d0\u4e2a\u57df\u540d\u542f\u7528&#xff08;\u6bd4\u5982ListenAddress server.example.com&#xff09;\u3002<\/p>\n<p>\u5982\u679c\u8981\u76d1\u542c\u591a\u4e2a\u6307\u5b9a\u7684 IP \u5730\u5740&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u591a\u884cListenAddress\u547d\u4ee4\u3002<\/p>\n<p>ListenAddress 172.16.1.1<br \/>\nListenAddress 192.168.0.1  <\/p>\n<p>LoginGraceTime<\/p>\n<p>LoginGraceTime\u6307\u5b9a\u5141\u8bb8\u5ba2\u6237\u7aef\u767b\u5f55\u65f6\u53d1\u5446\u7684\u6700\u957f\u65f6\u95f4&#xff0c;\u6bd4\u5982\u7528\u6237\u8fdf\u8fdf\u4e0d\u8f93\u5165\u5bc6\u7801&#xff0c;\u8fde\u63a5\u5c31\u4f1a\u81ea\u52a8\u65ad\u5f00&#xff0c;\u5355\u4f4d\u4e3a\u79d2&#xff08;LoginGraceTime 60&#xff09;\u3002\u5982\u679c\u8bbe\u4e3a0&#xff0c;\u5c31\u8868\u793a\u6ca1\u6709\u9650\u5236\u3002<\/p>\n<p>LogLevel<\/p>\n<p>LogLevel\u6307\u5b9a\u65e5\u5fd7\u7684\u8be6\u7ec6\u7a0b\u5ea6&#xff0c;\u53ef\u80fd\u7684\u503c\u4f9d\u6b21\u4e3aQUIET\u3001FATAL\u3001ERROR\u3001INFO\u3001VERBOSE\u3001DEBUG\u3001DEBUG1\u3001DEBUG2\u3001DEBUG3&#xff0c;\u9ed8\u8ba4\u4e3aINFO&#xff08;LogLevel INFO&#xff09;\u3002<\/p>\n<p>MACs<\/p>\n<p>MACs\u6307\u5b9asshd \u53ef\u4ee5\u63a5\u53d7\u7684\u6570\u636e\u6821\u9a8c\u7b97\u6cd5&#xff08;MACs hmac-sha1&#xff09;&#xff0c;\u591a\u4e2a\u7b97\u6cd5\u4e4b\u95f4\u4f7f\u7528\u9017\u53f7\u5206\u9694\u3002<\/p>\n<p>MaxAuthTries<\/p>\n<p>MaxAuthTries\u6307\u5b9a\u5141\u8bb8 SSH \u767b\u5f55\u7684\u6700\u5927\u5c1d\u8bd5\u6b21\u6570&#xff08;MaxAuthTries 3&#xff09;&#xff0c;\u5982\u679c\u5bc6\u7801\u8f93\u5165\u9519\u8bef\u8fbe\u5230\u6307\u5b9a\u6b21\u6570&#xff0c;SSH \u8fde\u63a5\u5c06\u5173\u95ed\u3002<\/p>\n<p>MaxStartups<\/p>\n<p>MaxStartups\u6307\u5b9a\u5141\u8bb8\u540c\u65f6\u5e76\u53d1\u7684 SSH \u8fde\u63a5\u6570\u91cf&#xff08;MaxStartups&#xff09;\u3002\u5982\u679c\u8bbe\u4e3a0&#xff0c;\u5c31\u8868\u793a\u6ca1\u6709\u9650\u5236\u3002<\/p>\n<p>\u8fd9\u4e2a\u5c5e\u6027\u4e5f\u53ef\u4ee5\u8bbe\u4e3aA:B:C\u7684\u5f62\u5f0f&#xff0c;\u6bd4\u5982MaxStartups 10:50:20&#xff0c;\u8868\u793a\u5982\u679c\u8fbe\u523010\u4e2a\u5e76\u53d1\u8fde\u63a5&#xff0c;\u540e\u9762\u7684\u8fde\u63a5\u5c06\u670950%\u7684\u6982\u7387\u88ab\u62d2\u7edd&#xff1b;\u5982\u679c\u8fbe\u523020\u4e2a\u5e76\u53d1\u8fde\u63a5&#xff0c;\u5219\u540e\u9762\u7684\u8fde\u63a5\u5c06100%\u88ab\u62d2\u7edd\u3002<\/p>\n<p>PasswordAuthentication<\/p>\n<p>PasswordAuthentication\u6307\u5b9a\u662f\u5426\u5141\u8bb8\u5bc6\u7801\u767b\u5f55&#xff0c;\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;PasswordAuthentication yes&#xff09;&#xff0c;\u5efa\u8bae\u6539\u6210no&#xff08;\u7981\u6b62\u5bc6\u7801\u767b\u5f55&#xff0c;\u53ea\u5141\u8bb8\u5bc6\u94a5\u767b\u5f55&#xff09;\u3002<\/p>\n<p>PermitEmptyPasswords<\/p>\n<p>PermitEmptyPasswords\u6307\u5b9a\u662f\u5426\u5141\u8bb8\u7a7a\u5bc6\u7801\u767b\u5f55&#xff0c;\u5373\u7528\u6237\u7684\u5bc6\u7801\u662f\u5426\u53ef\u4ee5\u4e3a\u7a7a&#xff0c;\u9ed8\u8ba4\u4e3ayes&#xff08;PermitEmptyPasswords yes&#xff09;&#xff0c;\u5efa\u8bae\u6539\u6210no&#xff08;\u7981\u6b62\u65e0\u5bc6\u7801\u767b\u5f55&#xff09;\u3002<\/p>\n<p>PermitRootLogin<\/p>\n<p>PermitRootLogin\u6307\u5b9a\u662f\u5426\u5141\u8bb8\u6839\u7528\u6237\u767b\u5f55&#xff0c;\u9ed8\u8ba4\u4e3ayes&#xff08;PermitRootLogin yes&#xff09;&#xff0c;\u5efa\u8bae\u6539\u6210no&#xff08;\u7981\u6b62\u6839\u7528\u6237\u767b\u5f55&#xff09;\u3002<\/p>\n<p>\u8fd8\u6709\u4e00\u79cd\u5199\u6cd5\u662f\u5199\u6210prohibit-password&#xff0c;\u8868\u793a root \u7528\u6237\u4e0d\u80fd\u7528\u5bc6\u7801\u767b\u5f55&#xff0c;\u4f46\u662f\u53ef\u4ee5\u7528\u5bc6\u94a5\u767b\u5f55\u3002<\/p>\n<p>PermitRootLogin prohibit-password  <\/p>\n<p>PermitUserEnvironment<\/p>\n<p>PermitUserEnvironment\u6307\u5b9a\u662f\u5426\u5141\u8bb8 sshd \u52a0\u8f7d\u5ba2\u6237\u7aef\u7684~\/.ssh\/environment\u6587\u4ef6\u548c~\/.ssh\/authorized_keys\u6587\u4ef6\u91cc\u9762\u7684environment&#061; options\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u3002\u9ed8\u8ba4\u503c\u4e3ano&#xff08;PermitUserEnvironment no&#xff09;\u3002<\/p>\n<p>Port<\/p>\n<p>Port\u6307\u5b9a sshd \u76d1\u542c\u7684\u7aef\u53e3&#xff0c;\u5373\u5ba2\u6237\u7aef\u8fde\u63a5\u7684\u7aef\u53e3&#xff0c;\u9ed8\u8ba4\u662f22&#xff08;Port 22&#xff09;\u3002\u51fa\u4e8e\u5b89\u5168\u8003\u8651&#xff0c;\u53ef\u4ee5\u6539\u6389\u8fd9\u4e2a\u7aef\u53e3&#xff08;\u6bd4\u5982Port 8822&#xff09;\u3002<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2aPort\u547d\u4ee4&#xff0c;\u540c\u65f6\u76d1\u542c\u591a\u4e2a\u7aef\u53e3\u3002<\/p>\n<p>Port 22<br \/>\nPort 80<br \/>\nPort 443<br \/>\nPort 8080  <\/p>\n<p>\u4e0a\u9762\u7684\u793a\u4f8b\u8868\u793a\u540c\u65f6\u76d1\u542c4\u4e2a\u7aef\u53e3\u3002<\/p>\n<p>PrintMotd<\/p>\n<p>PrintMotd\u6307\u5b9a\u7528\u6237\u767b\u5f55\u540e&#xff0c;\u662f\u5426\u5411\u5176\u5c55\u793a\u7cfb\u7edf\u7684 motd&#xff08;Message of the day&#xff09;\u7684\u4fe1\u606f\u6587\u4ef6\/etc\/motd\u3002\u8be5\u6587\u4ef6\u7528\u4e8e\u901a\u77e5\u6240\u6709\u7528\u6237\u4e00\u4e9b\u91cd\u8981\u4e8b\u9879&#xff0c;\u6bd4\u5982\u7cfb\u7edf\u7ef4\u62a4\u65f6\u95f4\u3001\u5b89\u5168\u95ee\u9898\u7b49\u7b49\u3002\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;PrintMotd yes&#xff09;&#xff0c;\u7531\u4e8e Shell \u4e00\u822c\u4f1a\u5c55\u793a\u8fd9\u4e2a\u4fe1\u606f\u6587\u4ef6&#xff0c;\u6240\u4ee5\u8fd9\u91cc\u53ef\u4ee5\u6539\u4e3ano\u3002<\/p>\n<p>PrintLastLog<\/p>\n<p>PrintLastLog\u6307\u5b9a\u662f\u5426\u6253\u5370\u4e0a\u4e00\u6b21\u7528\u6237\u767b\u5f55\u65f6\u95f4&#xff0c;\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;PrintLastLog yes&#xff09;\u3002<\/p>\n<p>Protocol<\/p>\n<p>Protocol\u6307\u5b9a sshd \u4f7f\u7528\u7684\u534f\u8bae\u3002Protocol 1\u8868\u793a\u4f7f\u7528 SSH 1 \u534f\u8bae&#xff0c;\u5efa\u8bae\u6539\u6210Protocol 2&#xff08;\u4f7f\u7528 SSH 2 \u534f\u8bae&#xff09;\u3002Protocol 2,1\u8868\u793a\u540c\u65f6\u652f\u6301\u4e24\u4e2a\u7248\u672c\u7684\u534f\u8bae\u3002<\/p>\n<p>PubKeyAuthentication<\/p>\n<p>PubKeyAuthentication\u6307\u5b9a\u662f\u5426\u5141\u8bb8\u516c\u94a5\u767b\u5f55&#xff0c;\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;PubKeyAuthentication yes&#xff09;\u3002<\/p>\n<p>QuietMode<\/p>\n<p>SSH 1 \u7248\u672c\u4e13\u7528&#xff0c;\u6307\u5b9a\u65e5\u5fd7\u53ea\u8f93\u51fa\u81f4\u547d\u7684\u9519\u8bef\u4fe1\u606f&#xff08;QuietMode yes&#xff09;\u3002<\/p>\n<p>RSAAuthentication<\/p>\n<p>RSAAuthentication\u6307\u5b9a\u5141\u8bb8 RSA \u8ba4\u8bc1&#xff0c;\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;RSAAuthentication yes&#xff09;\u3002<\/p>\n<p>ServerKeyBits<\/p>\n<p>ServerKeyBits\u6307\u5b9a SSH 1 \u7248\u672c\u7684\u5bc6\u94a5\u91cd\u65b0\u751f\u6210\u65f6\u7684\u4f4d\u6570&#xff0c;\u9ed8\u8ba4\u662f768&#xff08;ServerKeyBits 768&#xff09;\u3002<\/p>\n<p>StrictModes<\/p>\n<p>StrictModes\u6307\u5b9a sshd \u662f\u5426\u68c0\u67e5\u7528\u6237\u7684\u4e00\u4e9b\u91cd\u8981\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u6743\u9650\u3002\u9ed8\u8ba4\u4e3ayes&#xff08;StrictModes yes&#xff09;&#xff0c;\u5373\u5bf9\u4e8e\u7528\u6237\u7684 SSH \u914d\u7f6e\u6587\u4ef6\u3001\u5bc6\u94a5\u6587\u4ef6\u548c\u6240\u5728\u76ee\u5f55&#xff0c;SSH \u8981\u6c42\u62e5\u6709\u8005\u5fc5\u987b\u662f\u6839\u7528\u6237\u6216\u7528\u6237\u672c\u4eba&#xff0c;\u7528\u6237\u7ec4\u548c\u5176\u4ed6\u4eba\u7684\u5199\u6743\u9650\u5fc5\u987b\u5173\u95ed\u3002<\/p>\n<p>SyslogFacility<\/p>\n<p>SyslogFacility\u6307\u5b9a Syslog \u5982\u4f55\u5904\u7406 sshd \u7684\u65e5\u5fd7&#xff0c;\u9ed8\u8ba4\u662f Auth&#xff08;SyslogFacility AUTH&#xff09;\u3002<\/p>\n<p>TCPKeepAlive<\/p>\n<p>TCPKeepAlive\u6307\u5b9a\u6253\u5f00 sshd \u8ddf\u5ba2\u6237\u7aef TCP \u8fde\u63a5\u7684 keepalive \u53c2\u6570&#xff08;TCPKeepAlive yes&#xff09;\u3002<\/p>\n<p>UseDNS<\/p>\n<p>UseDNS\u6307\u5b9a\u7528\u6237 SSH \u767b\u5f55\u4e00\u4e2a\u57df\u540d\u65f6&#xff0c;\u670d\u52a1\u5668\u662f\u5426\u4f7f\u7528 DNS&#xff0c;\u786e\u8ba4\u8be5\u57df\u540d\u5bf9\u5e94\u7684 IP \u5730\u5740\u5305\u542b\u672c\u673a&#xff08;UseDNS yes&#xff09;\u3002\u6253\u5f00\u8be5\u9009\u9879\u610f\u4e49\u4e0d\u5927&#xff0c;\u800c\u4e14\u5982\u679c DNS \u66f4\u65b0\u4e0d\u53ca\u65f6&#xff0c;\u8fd8\u6709\u53ef\u80fd\u8bef\u5224&#xff0c;\u5efa\u8bae\u5173\u95ed\u3002<\/p>\n<p>UseLogin<\/p>\n<p>UseLogin\u6307\u5b9a\u7528\u6237\u8ba4\u8bc1\u5185\u90e8\u662f\u5426\u4f7f\u7528\/usr\/bin\/login\u66ff\u4ee3 SSH \u5de5\u5177&#xff0c;\u9ed8\u8ba4\u4e3ano&#xff08;UseLogin no&#xff09;\u3002<\/p>\n<p>UserPrivilegeSeparation<\/p>\n<p>UserPrivilegeSeparation\u6307\u5b9a\u7528\u6237\u8ba4\u8bc1\u901a\u8fc7\u4ee5\u540e&#xff0c;\u4f7f\u7528\u53e6\u4e00\u4e2a\u5b50\u7ebf\u7a0b\u5904\u7406\u7528\u6237\u6743\u9650\u76f8\u5173\u7684\u64cd\u4f5c&#xff0c;\u8fd9\u6837\u6709\u5229\u4e8e\u63d0\u9ad8\u5b89\u5168\u6027\u3002\u9ed8\u8ba4\u503c\u4e3ayes&#xff08;UsePrivilegeSeparation yes&#xff09;\u3002<\/p>\n<p>VerboseMode<\/p>\n<p>SSH 2 \u7248\u672c\u4e13\u7528&#xff0c;\u6307\u5b9a\u65e5\u5fd7\u8f93\u51fa\u8be6\u7ec6\u7684 Debug \u4fe1\u606f&#xff08;VerboseMode yes&#xff09;\u3002<\/p>\n<p>X11Forwarding<\/p>\n<p>X11Forwarding\u6307\u5b9a\u662f\u5426\u6253\u5f00 X window \u7684\u8f6c\u53d1&#xff0c;\u9ed8\u8ba4\u503c\u4e3a no&#xff08;X11Forwarding no&#xff09;\u3002<\/p>\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u4ee5\u540e&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u9a8c\u8bc1&#xff0c;\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u6709\u8bed\u6cd5\u9519\u8bef\u3002<\/p>\n<p>$ sshd -t  <\/p>\n<p>\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\u751f\u6548&#xff0c;\u5fc5\u987b\u91cd\u542f sshd\u3002<\/p>\n<p>$ sudo systemctl restart sshd  <\/p>\n<h3 id=\"sshd%20%E7%9A%84%E5%91%BD%E4%BB%A4%E8%A1%8C%E9%85%8D%E7%BD%AE%E9%A1%B9\">sshd \u7684\u547d\u4ee4\u884c\u914d\u7f6e\u9879<\/h3>\n<p>sshd \u547d\u4ee4\u6709\u4e00\u4e9b\u914d\u7f6e\u9879\u3002\u8fd9\u4e9b\u914d\u7f6e\u9879\u5728\u8c03\u7528\u65f6\u6307\u5b9a&#xff0c;\u53ef\u4ee5\u8986\u76d6\u914d\u7f6e\u6587\u4ef6\u7684\u8bbe\u7f6e\u3002<\/p>\n<p>&#xff08;1&#xff09;-d<\/p>\n<p>-d\u53c2\u6570\u7528\u4e8e\u663e\u793a debug \u4fe1\u606f\u3002<\/p>\n<p>$ sshd -d  <\/p>\n<p>&#xff08;2&#xff09;-D<\/p>\n<p>-D\u53c2\u6570\u6307\u5b9a sshd \u4e0d\u4f5c\u4e3a\u540e\u53f0\u5b88\u62a4\u8fdb\u7a0b\u8fd0\u884c\u3002<\/p>\n<p>$ sshd -D  <\/p>\n<p>&#xff08;3&#xff09;-e<\/p>\n<p>-e\u53c2\u6570\u5c06 sshd \u5199\u5165\u7cfb\u7edf\u65e5\u5fd7 syslog \u7684\u5185\u5bb9\u5bfc\u5411\u6807\u51c6\u9519\u8bef&#xff08;standard error&#xff09;\u3002<\/p>\n<p>&#xff08;4&#xff09;-f<\/p>\n<p>-f\u53c2\u6570\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>&#xff08;5&#xff09;-h<\/p>\n<p>-h\u53c2\u6570\u7528\u4e8e\u6307\u5b9a\u5bc6\u94a5\u3002<\/p>\n<p>$ sshd -h \/usr\/local\/ssh\/my_rsa_key  <\/p>\n<p>&#xff08;6&#xff09;-o<\/p>\n<p>-o\u53c2\u6570\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u7684\u4e00\u4e2a\u914d\u7f6e\u9879\u548c\u5bf9\u5e94\u7684\u503c\u3002<\/p>\n<p>$ sshd -o &#034;Port 2034&#034;  <\/p>\n<p>\u914d\u7f6e\u9879\u548c\u5bf9\u5e94\u503c\u4e4b\u95f4&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u7b49\u53f7\u3002<\/p>\n<p>$ sshd -o &#034;Port &#061; 2034&#034;  <\/p>\n<p>\u5982\u679c\u7701\u7565\u7b49\u53f7\u524d\u540e\u7684\u7a7a\u683c&#xff0c;\u4e5f\u53ef\u4ee5\u4e0d\u4f7f\u7528\u5f15\u53f7\u3002<\/p>\n<p>$ sshd -o Port&#061;2034  <\/p>\n<p>-o\u53c2\u6570\u53ef\u4ee5\u591a\u4e2a\u4e00\u8d77\u4f7f\u7528&#xff0c;\u7528\u6765\u6307\u5b9a\u591a\u4e2a\u914d\u7f6e\u5173\u952e\u5b57\u3002<\/p>\n<p>&#xff08;7&#xff09;-p<\/p>\n<p>-p\u53c2\u6570\u6307\u5b9a sshd \u7684\u670d\u52a1\u7aef\u53e3\u3002<\/p>\n<p>$ sshd -p 2034  <\/p>\n<p>\u4e0a\u9762\u547d\u4ee4\u6307\u5b9a sshd \u57282034\u7aef\u53e3\u542f\u52a8\u3002<\/p>\n<p>-p\u53c2\u6570\u53ef\u4ee5\u6307\u5b9a\u591a\u4e2a\u7aef\u53e3\u3002<\/p>\n<p>$ sshd -p 2222 -p 3333  <\/p>\n<p>&#xff08;8&#xff09;-t<\/p>\n<p>-t\u53c2\u6570\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u7684\u8bed\u6cd5\u662f\u5426\u6b63\u786e\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250813233716-689d21acbbcf4.gif\" \/><\/p>\n<p>\u2764\ufe0f\u2764\ufe0f\u2764\ufe0f\u672c\u4eba\u6c34\u5e73\u6709\u9650&#xff0c;\u5982\u6709\u7eb0\u6f0f&#xff0c;\u6b22\u8fce\u5404\u4f4d\u5927\u4f6c\u8bc4\u8bba\u6279\u8bc4\u6307\u6b63&#xff01;&#x1f604;&#x1f604;&#x1f604;<\/p>\n<p>&#x1f498;&#x1f498;&#x1f498;\u5982\u679c\u89c9\u5f97\u8fd9\u7bc7\u6587\u5bf9\u4f60\u6709\u5e2e\u52a9\u7684\u8bdd&#xff0c;\u4e5f\u8bf7\u7ed9\u4e2a\u70b9\u8d5e\u3001\u6536\u85cf\u4e0b\u5427&#xff0c;\u975e\u5e38\u611f\u8c22!&#x1f44d; &#x1f44d; &#x1f44d;<\/p>\n<p>&#x1f525;&#x1f525;&#x1f525;Stay Hungry Stay Foolish \u9053\u963b\u4e14\u957f,\u884c\u5219\u5c06\u81f3,\u8ba9\u6211\u4eec\u4e00\u8d77\u52a0\u6cb9\u5427&#xff01;&#x1f319;&#x1f319;&#x1f319;<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb869\u6b21\uff0c\u70b9\u8d5e33\u6b21\uff0c\u6536\u85cf22\u6b21\u3002\u8fd9\u7bc7\u6587\u7ae0\u8be6\u7ec6\u4ecb\u7ecd\u4e86SSH\u670d\u52a1\u5668\u8f6f\u4ef6sshd\u7684\u914d\u7f6e\u548c\u4f7f\u7528\u65b9\u6cd5\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1. \u5b89\u88c5\u548c\u542f\u52a8sshd\u670d\u52a1\u7684\u547d\u4ee4\uff1b2. sshd\u7684\u914d\u7f6e\u6587\u4ef6sshd_config\u7684\u683c\u5f0f\u548c\u8bed\u6cd5\uff1b3. \u5bc6\u94a5\u6587\u4ef6\u7684\u7ba1\u7406\u548c\u914d\u7f6e\uff1b4. \u5e38\u7528\u7684\u914d\u7f6e\u9879\u8be6\u89e3\uff0c\u5982\u7aef\u53e3\u8bbe\u7f6e\u3001\u767b\u5f55\u6743\u9650\u3001\u52a0\u5bc6\u7b97\u6cd5\u7b49\uff1b5. sshd\u547d\u4ee4\u884c\u53c2\u6570\u7684\u4f7f\u7528\u3002\u6587\u7ae0\u8fd8\u63d0\u4f9b\u4e86\u4fee\u6539\u914d\u7f6e\u540e\u7684\u9a8c\u8bc1\u65b9\u6cd5\u548c\u91cd\u542f\u670d\u52a1\u7684\u64cd\u4f5c\u6b65\u9aa4\u3002\u5bf9\u4e8e\u7cfb\u7edf\u7ba1\u7406\u5458\u548c\u9700\u8981\u914d\u7f6eSSH\u670d\u52a1\u5668\u7684\u7528\u6237\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u4efd\u8be6\u5b9e\u7684\u6280\u672f\u53c2\u8003\u6587\u6863\uff0c\u6db5\u76d6\u4e86sshd\u7684\u4e3b\u8981\u529f\u80fd\u548c\u914d\u7f6e\u8981\u70b9\u3002<\/p>\n","protected":false},"author":2,"featured_media":55733,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[77,43,44],"topic":[],"class_list":["post-55736","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ssh","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HoRain\u4e91-SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/55736.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HoRain\u4e91-SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb869\u6b21\uff0c\u70b9\u8d5e33\u6b21\uff0c\u6536\u85cf22\u6b21\u3002\u8fd9\u7bc7\u6587\u7ae0\u8be6\u7ec6\u4ecb\u7ecd\u4e86SSH\u670d\u52a1\u5668\u8f6f\u4ef6sshd\u7684\u914d\u7f6e\u548c\u4f7f\u7528\u65b9\u6cd5\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1. \u5b89\u88c5\u548c\u542f\u52a8sshd\u670d\u52a1\u7684\u547d\u4ee4\uff1b2. sshd\u7684\u914d\u7f6e\u6587\u4ef6sshd_config\u7684\u683c\u5f0f\u548c\u8bed\u6cd5\uff1b3. \u5bc6\u94a5\u6587\u4ef6\u7684\u7ba1\u7406\u548c\u914d\u7f6e\uff1b4. \u5e38\u7528\u7684\u914d\u7f6e\u9879\u8be6\u89e3\uff0c\u5982\u7aef\u53e3\u8bbe\u7f6e\u3001\u767b\u5f55\u6743\u9650\u3001\u52a0\u5bc6\u7b97\u6cd5\u7b49\uff1b5. sshd\u547d\u4ee4\u884c\u53c2\u6570\u7684\u4f7f\u7528\u3002\u6587\u7ae0\u8fd8\u63d0\u4f9b\u4e86\u4fee\u6539\u914d\u7f6e\u540e\u7684\u9a8c\u8bc1\u65b9\u6cd5\u548c\u91cd\u542f\u670d\u52a1\u7684\u64cd\u4f5c\u6b65\u9aa4\u3002\u5bf9\u4e8e\u7cfb\u7edf\u7ba1\u7406\u5458\u548c\u9700\u8981\u914d\u7f6eSSH\u670d\u52a1\u5668\u7684\u7528\u6237\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u4efd\u8be6\u5b9e\u7684\u6280\u672f\u53c2\u8003\u6587\u6863\uff0c\u6db5\u76d6\u4e86sshd\u7684\u4e3b\u8981\u529f\u80fd\u548c\u914d\u7f6e\u8981\u70b9\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/55736.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-13T23:37:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250813233716-689d21ac0155b.jpg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/55736.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/55736.html\",\"name\":\"HoRain\u4e91-SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-13T23:37:17+00:00\",\"dateModified\":\"2025-08-13T23:37:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/55736.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/55736.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/55736.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HoRain\u4e91--SSH \u670d\u52a1\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HoRain\u4e91-SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/55736.html","og_locale":"zh_CN","og_type":"article","og_title":"HoRain\u4e91-SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb869\u6b21\uff0c\u70b9\u8d5e33\u6b21\uff0c\u6536\u85cf22\u6b21\u3002\u8fd9\u7bc7\u6587\u7ae0\u8be6\u7ec6\u4ecb\u7ecd\u4e86SSH\u670d\u52a1\u5668\u8f6f\u4ef6sshd\u7684\u914d\u7f6e\u548c\u4f7f\u7528\u65b9\u6cd5\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1. \u5b89\u88c5\u548c\u542f\u52a8sshd\u670d\u52a1\u7684\u547d\u4ee4\uff1b2. sshd\u7684\u914d\u7f6e\u6587\u4ef6sshd_config\u7684\u683c\u5f0f\u548c\u8bed\u6cd5\uff1b3. \u5bc6\u94a5\u6587\u4ef6\u7684\u7ba1\u7406\u548c\u914d\u7f6e\uff1b4. \u5e38\u7528\u7684\u914d\u7f6e\u9879\u8be6\u89e3\uff0c\u5982\u7aef\u53e3\u8bbe\u7f6e\u3001\u767b\u5f55\u6743\u9650\u3001\u52a0\u5bc6\u7b97\u6cd5\u7b49\uff1b5. sshd\u547d\u4ee4\u884c\u53c2\u6570\u7684\u4f7f\u7528\u3002\u6587\u7ae0\u8fd8\u63d0\u4f9b\u4e86\u4fee\u6539\u914d\u7f6e\u540e\u7684\u9a8c\u8bc1\u65b9\u6cd5\u548c\u91cd\u542f\u670d\u52a1\u7684\u64cd\u4f5c\u6b65\u9aa4\u3002\u5bf9\u4e8e\u7cfb\u7edf\u7ba1\u7406\u5458\u548c\u9700\u8981\u914d\u7f6eSSH\u670d\u52a1\u5668\u7684\u7528\u6237\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u4efd\u8be6\u5b9e\u7684\u6280\u672f\u53c2\u8003\u6587\u6863\uff0c\u6db5\u76d6\u4e86sshd\u7684\u4e3b\u8981\u529f\u80fd\u548c\u914d\u7f6e\u8981\u70b9\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/55736.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-13T23:37:17+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250813233716-689d21ac0155b.jpg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/55736.html","url":"https:\/\/www.wsisp.com\/helps\/55736.html","name":"HoRain\u4e91-SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-13T23:37:17+00:00","dateModified":"2025-08-13T23:37:17+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/55736.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/55736.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/55736.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"HoRain\u4e91--SSH \u670d\u52a1\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/55736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=55736"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/55736\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/55733"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=55736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=55736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=55736"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=55736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}