{"id":87978,"date":"2024-02-03T13:26:51","date_gmt":"2024-02-03T05:26:51","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=87978"},"modified":"2024-02-03T13:26:51","modified_gmt":"2024-02-03T05:26:51","slug":"openssh-advanced-use","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/openssh-advanced-use.html","title":{"rendered":"OpenSSH \u9ad8\u7ea7\u8fd0\u7528\u4e24\u5219"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nOpenSSH\uff08OpenBSD Secure Shell\uff09\u4f7f\u7528 SSH \u901a\u8fc7\u8ba1\u7b97\u673a\u7f51\u7edc\u52a0\u5bc6\u901a\u4fe1\u7684\u5b9e\u73b0\u3002\u5b83\u662f\u66ff\u6362\u7531 SSH Communications Security \u6240\u63d0\u4f9b\u7684\u5546\u7528\u7248\u672c\u7684\u5f00\u653e\u6e90\u4ee3\u7801\u65b9\u6848\u3002\u76ee\u524d OpenSSH \u662f OpenBSD \u7684\u5b50\u9879\u76ee\u3002\u5927\u5bb6\u90fd\u53ea\u77e5\u9053 SSH \u53ef\u4ee5\u57fa\u4e8e\u5bc6\u7801\u6216\u5bc6\u94a5\u767b\u5f55\u8fdc\u7a0b\u4e3b\u673a\u4f7f\u7528\uff0c\u4f46\u662f\u4f60\u77e5\u9053\u5417\uff1f\u5176\u5b9e SSH \u8fd8\u53ef\u4ee5\u5728\u8fd0\u7528\u5728\u516c\u7f51\u670d\u52a1\u5668\u8fde\u63a5\u79c1\u6709IP\u865a\u62df\u673a\uff0c\u8fd8\u53ef\u4ee5\u5b9e\u73b0\u547d\u4ee4\u884c SSH \u4ee3\u7406\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
00\u00d71\u3001\u516c\u7f51\u670d\u52a1\u5668\u8fde\u63a5\u79c1\u6709IP\u865a\u62df\u673a<\/strong><\/div>\n

\u8bd5\u9a8c\u73af\u5883\u4e3a\u4e24\u53f0 CentOS \u7cfb\u7edf\uff1a<\/p>\n

\u4e00\u53f0\u4e3a\u516c\u7f51\u670d\u52a1\u5668 rabbit \uff1a45.xxx.xxx.212<\/strong><\/span><\/div>\n

\"\"<\/p>\n

\u4e00\u53f0\u4e3a VirtualBox NAT \u6a21\u5f0f\u4e0b\u7684 CentOS \u865a\u62df\u673a CentosA\uff1a10.0.2.15<\/strong><\/span><\/div>\n

NAT \u666e\u904d\u4f7f\u7528\u5728\u6709\u591a\u53f0\u4e3b\u673a\u4f46\u53ea\u901a\u8fc7\u4e00\u4e2a\u516c\u6709 IP \u5730\u5740\u8bbf\u95ee\u56e0\u7279\u7f51\u7684\u79c1\u6709\u7f51\u7edc\u4e2d\uff0c\u5b83\u5141\u8bb8\u4e86\u591a\u53f0\u4e3b\u673a\u5171\u4eab\u4e00\u4e2a\u516c\u7528 IP \u5730\u5740\uff08\u5373\u865a\u62df\u673a\u7684\u6240\u6709\u6570\u636e\u5305\u6700\u540e\u90fd\u7531\u7f51\u7edc\u4e2d\u90a3\u53f0\u6709\u516c\u7f51 IP \u5730\u5740\u4e3b\u673a\u8f6c\u53d1\u51fa\u4e92\u8054\u7f51\uff09\u3002
\n\"\"
\n\"\"
\n\u9996\u5148\u5728 NAT \u540e\u9762\u7684\u865a\u62df\u673a\u5185\u5efa\u7acb\u7aef\u53e3\u8f6c\u53d1\uff0c\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n

ssh -gfN -R < \u516c\u7f51\u6620\u5c04\u7aef\u53e3>:127.0.0.1:< \u672c\u5730\u7aef\u53e3> < \u76ee\u6807\u516c\u7f51><\/pre>\n
\u547d\u4ee4\u4e2d\u201cSSH\u201d\u53c2\u6570\u4ecb\u7ecd<\/strong><\/span><\/div>\n
    \n
  1. \n
      -g\uff1a\u5141\u8bb8\u8fdc\u7a0b\u4e3b\u673a\u8fde\u63a5\u5230\u672c\u5730\u5efa\u7acb\u7684\u8f6c\u53d1\u7aef\u53e3<\/ol>\n<\/li>\n<\/ol>\n
        \n
      1. \n
          -fN\uff1a\u4e0d\u767b\u5f55\u4e0d\u6267\u884c\u811a\u672c\u6216\u547d\u4ee4\uff08\u7ecf\u5e38\u8fde\u7528\uff09<\/ol>\n<\/li>\n<\/ol>\n
            \n
          1. \n
              -C\uff1a\u538b\u7f29\u6570\u636e\u4f20\u8f93\uff08\u5c0f\u5e26\u5bbd\u53ef\u7528\uff09<\/ol>\n<\/li>\n<\/ol>\n

               <\/p>\n

                -R\uff1a\u7a0b\u5e8f\u7ea7\u7aef\u53e3\u8f6c\u53d1 \uff0c\u201cport:host:hostport\u201d\u65b9\u6cd5\uff08\u5fc5\u987b\u4f7f\u7528\uff09<\/ol>\n

                \u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\uff0c\u547d\u4ee4\u5982\u4e0b\uff08\u5904\u4e8e\u5b89\u5168\u7684\u539f\u56e0\uff0c\u9690\u85cf\u4e86\u8fdc\u7aef\u516c\u7f51\u5730\u5740\uff09\uff1a<\/p>\n

                # ssh -gfN -R 1111:127.0.0.1:22 45.xxx.xxx.212<\/pre>\n

                \"\"<\/p>\n

                \u63a5\u7740\uff0c\u4ece\u516c\u7f51\u670d\u52a1\u5668 45.xxx.xxx.212 \u4e0a\u8fde\u63a5 NAT \u540e\u9762\u7684\u865a\u62df\u673a\uff0c\u8f93\u5165\u547d\u4ee4\uff1a<\/p>\n

                ssh -p 1111 localhost<\/pre>\n

                \"\"<\/p>\n

                \u4ee5\u4e0a\u4ece\u516c\u7f51\u670d\u52a1\u5668\u8fde\u63a5\u5230\u865a\u62df\u673a\u79c1\u6709 IP \u5b9e\u9a8c\u7ed3\u675f\uff0c\u4e0b\u9762\u662f\u8fd0\u7528 SSH \u5efa\u7acb Proxy \u4ee3\u7406\u3002<\/p>\n

                00\u00d72\u3001\u5efa\u7acb SSH \u4ee3\u7406<\/strong><\/div>\n

                \u4ee3\u7406\uff08Proxy\uff09\uff0c\u4e5f\u79f0\u7f51\u7edc\u4ee3\u7406\uff0c\u662f\u4e00\u79cd\u7279\u6b8a\u7684\u7f51\u7edc\u670d\u52a1\uff0c\u5141\u8bb8\u4e00\u4e2a\u7f51\u7edc\u7ec8\u7aef\uff08\u4e00\u822c\u4e3a\u5ba2\u6237\u7aef\uff09\u901a\u8fc7\u8fd9\u4e2a\u670d\u52a1\u4e0e\u53e6\u4e00\u4e2a\u7f51\u7edc\u7ec8\u7aef\uff08\u4e00\u822c\u4e3a\u670d\u52a1\u5668\uff09\u8fdb\u884c\u975e\u76f4\u63a5\u7684\u8fde\u63a5\u3002\u4e00\u4e9b\u7f51\u5173\u3001\u8def\u7531\u5668\u7b49\u7f51\u7edc\u8bbe\u5907\u5177\u5907\u7f51\u7edc\u4ee3\u7406\u529f\u80fd\u3002\u4e00\u822c\u8ba4\u4e3a\u4ee3\u7406\u670d\u52a1\u6709\u5229\u4e8e\u4fdd\u969c\u7f51\u7edc\u7ec8\u7aef\u7684\u9690\u79c1\u6216\u5b89\u5168\uff0c\u9632\u6b62\u653b\u51fb\u3002
                \n\"\"<\/p>\n

                \u56fe\u89e3\uff1a\u5de6\u8fb9\u548c\u53f3\u8fb9\u7684\u7535\u8111\u5728\u901a\u8baf\u65f6\u5019\uff0c\u9700\u8981\u7ecf\u8fc7\u4e2d\u95f4\u7684\u7535\u8111\u4e2d\u8f6c\uff0c\u800c\u4e2d\u95f4\u7684\u90a3\u90e8\u7535\u8111\u5c31\u662f\u4ee3\u7406\u670d\u52a1\u5668\u3002\u7b80\u5355\u7684\u8bf4\u5c31\u662f A \u8981\u8bbf\u95ee C\uff0c\u5373\u4fbf\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee C\uff0c\u4f46\u662f\u6709\u4fe9\u4e2a\u95ee\u9898\uff1a\u4e00\u4e2a\u662f\u5b89\u5168\u7684\u95ee\u9898\uff0c\u53e6\u5916\u8fd8\u6709\u5c31\u662f\u201c\u8fc7\u6ee4\u95ee\u9898\u201d\u3002\u4e8e\u662f\u6211\u4eec\u6709\u4e86\u201c\u4ee3\u7406\u201d\u5c31\u662f\u8ba9\u6211\u4eec A \u8fde\u63a5 B\uff0c\u7531 B \u53bb\u8bbf\u95ee C\uff0cB \u6700\u540e\u201c\u52a0\u5bc6\u201d\u4f20\u9001\u7ed9\u7528\u6237\uff0c\u6700\u540e\u7528\u6237\u5c31\u5f97\u5230\u4e86\u60f3\u8981\u7684\u6765\u81ea C \u7684\u4fe1\u606f\u3002<\/p>\n

                \u670d\u52a1\u5668\u7aef\u4ee3\u7406\u8bbe\u7f6e<\/strong><\/span><\/div>\n

                \u672c\u673a\u8f93\u5165\u5982\u4e0b\u547d\u4ee4\u5b9e\u73b0 SSH \u4ee3\u7406\uff1a<\/p>\n

                ssh -nNT @ -D [user]@[ip] -D [port] <\/pre>\n
                \u53c2\u6570\u4ecb\u7ecd<\/strong><\/span><\/div>\n
                  \n
                1. \n
                    -n\uff1a\u540e\u53f0\u8fd0\u884c<\/ol>\n<\/li>\n<\/ol>\n
                      \n
                    1. \n
                        -N\uff1a\u4e0d\u6267\u884c\u8fdc\u7a0b\u6307\u4ee4<\/ol>\n<\/li>\n<\/ol>\n
                          \n
                        1. \n
                            -T\uff1a\u4e0d\u5206\u914d TTY \uff0c\u53ea\u505a\u4ee3\u7406\u7528<\/ol>\n<\/li>\n<\/ol>\n
                              -D\uff1a\u6307\u5b9a\u4ee3\u7406\u7aef\u53e3<\/ol>\n

                              \"\"<\/p>\n

                              \u4e0a\u8ff0\u547d\u4ee4\u7684\u610f\u601d\u662f\uff0c\u5728\u672c\u5730\u76d1\u542c\u7aef\u53e3 1111\uff0c\u5c06\u8bbf\u95ee\u5230\u8be5\u7aef\u53e3\u7684\u6d41\u91cf\u8f6c\u53d1\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\uff0c\u8fdc\u7a0b\u670d\u52a1\u5668\u7684\u7528\u6237\u51ed\u8bc1\u7531\u547d\u4ee4\u884c\u6307\u5b9a\u3002\u81f3\u6b64\uff0cSSH \u4ee3\u7406\u8bbe\u7f6e\u5df2\u7ecf\u5b8c\u6210\u4e86\u3002\u540e\u9762\u8981\u7528\u4ee3\u7406\u5de5\u5177\u5b8c\u6210 SSH \u4ee3\u7406\u3002<\/p>\n

                              \u5ba2\u6237\u7aef\u914d\u7f6e<\/strong><\/span><\/div>\n

                              \u5ba2\u6237\u7aef\u4f7f\u7528\u4ee3\u7406\u8bbe\u7f6e\uff08\u672c\u4eba\u8fd9\u91cc\u4f7f\u7528\u7684\u662fChrome\u6d4f\u89c8\u5668\u4e0b\u7684 SwitchyOmega \u5de5\u5177\uff0c\u540c\u7c7b\u4ee3\u7406\u8fd8\u53ef\u4ee5\u7528 Firefox \u6d4f\u89c8\u5668\u4e0b\u7684\u5de5\u5177 AutoProxy\uff09\uff1a
                              \n\"\"
                              \n\"\"<\/p>\n

                              \u8fd9\u91cc\u6211\u4eec\u901a\u8fc7\u4e86\u4ee3\u7406\u8bbe\u7f6e\uff0c\u6211\u4eec\u7684\u6d4f\u89c8\u5668\u548c\u201c\u963f\u91cc\u4e91\u201d\u670d\u52a1\u5668\u8fde\u63a5\u5b8c\u6210~\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u4ee3\u7406\u4e0a\u7f51\u3001\u52a0\u901f\u4e0a\u7f51\u3002\u751a\u81f3\u8fd8\u53ef\u4ee5\u79d1\u5b66\u4e0a\u7f51\uff01
                              \n\"\"<\/p>\n

                              00\u00d73\u3001\u603b\u7ed3\u5fc3\u5f97<\/strong><\/div>\n

                              \u7b2c\u4e00\u8282\u5e0c\u671b\u8ba9\u5927\u5bb6\u7075\u6d3b\u8fd0\u7528 SSH\uff0cSSH \u7684\u529f\u80fd\u4e0d\u4ec5\u4ec5\u53ea\u662f\u7b80\u5355\u7684\u8fdc\u7a0b\u8fde\u63a5\u90e8\u7f72\u3002\u901a\u8fc7 SSH \u8bbe\u7f6e\uff0c\u53ef\u4ee5\u8ba9\u4efb\u4f55\u4e00\u53f0\u673a\u5668\u901a\u8fc7 SSH \u76f8\u8fde\u63a5\u7684\uff01\u7b2c\u4e8c\u7bc7\u7684\u610f\u4e49\u5728\u4e8e\u4eab\u53d7\u8fdc\u7a0b\u4efb\u4f55\u4e00\u53f0\u673a\u5668\u540c\u65f6\uff0c\u8fd8\u53ef\u4ee5\u660e\u767d\uff0c\u80fd\u5b8c\u6210\u4e92\u8fde\u7684 SSH\u3002\u5f53\u7136\u4e5f\u53ef\u4ee5\u5b8c\u6210\u4ee3\u7406~\uff01<\/p>\n

                              \u4e0a\u8ff0\u5c31\u662f\u4e24\u6761 SSH \u8fd0\u7528\uff0c\u4ec5\u4ec5\u53ea\u662f\u629b\u7816\u5f15\u7389\u3002\u66f4\u591a\u597d\u73a9\u7684\uff0c\u9700\u8981\u6211\u4eec\u81ea\u5df1\u53bb\u53d1\u73b0\u53bb\u603b\u7ed3\u53bb\u8bbe\u7f6e\u53bb\u4eab\u53d7\uff0c\u4e5f\u662f\u5e0c\u671b\u5927\u5bb6\u4e0d\u5149\u6709\u5bbd\u5ea6\u66f4\u591a\u7684\u8fd8\u8981\u6709\u201c\u6df1\u5ea6\u201d\u3002<\/p>\n

                              \n

                              \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.toutiao.com\/a6487089072631185933\/<\/a><\/p>\n

                              \u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/openssh-advanced-use.html<\/a>\u7f16\u8f91\uff1a\u51af\u632f\u534e\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

                              \u5bfc\u8bfb OpenSSH\uff08OpenBSD Secure Shell\uff09\u4f7f\u7528 SSH \u901a\u8fc7\u8ba1\u7b97\u673a\u7f51\u7edc\u52a0\u5bc6\u901a\u4fe1\u7684\u5b9e\u73b0\u3002\u5b83 […]<\/p>\n","protected":false},"author":63,"featured_media":87992,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-87978","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/87978","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=87978"}],"version-history":[{"count":9,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/87978\/revisions"}],"predecessor-version":[{"id":88008,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/87978\/revisions\/88008"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/87992"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=87978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=87978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=87978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}