{"id":143,"date":"2023-03-11T14:54:45","date_gmt":"2023-03-11T06:54:45","guid":{"rendered":"http:\/\/jemlab.cn\/?p=143"},"modified":"2023-03-12T16:33:38","modified_gmt":"2023-03-12T08:33:38","slug":"ubuntu%e8%ae%a9%e7%bb%88%e7%ab%af%e8%b5%b0%e4%bb%a3%e7%90%86%e7%9a%84%e5%8a%9e%e6%b3%95httpssh","status":"publish","type":"post","link":"http:\/\/jemlab.cn\/?p=143","title":{"rendered":"Ubuntu\u8ba9\u7ec8\u7aef\u8d70\u4ee3\u7406\u7684\u529e\u6cd5http&#038;ssh\u3010\u8f6c\u8f7d\u3011"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\u81ea\uff1ahttp:\/\/www.voycn.com\/article\/ubunturangzhongduanzoudailidebanfahttpssh<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">http\u4ee3\u7406\u7684\u51e0\u79cd\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u65b9\u6cd51:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u5728\u7ec8\u7aef\u4e2d\u76f4\u63a5\u8fd0\u884c\u547d\u4ee4,\u5982\u679c\u662fshadowsockets\u7684socks5\u8fd9\u4e2a\u7edd\u5bf9\u4e0d\u884c,\u5fc5\u987b\u8981socks5\n export http_proxy=http:\/\/proxyAddress:port\n\u8fd9\u4e2a\u529e\u6cd5\u7684\u597d\u5904\u662f\u7b80\u5355\u76f4\u63a5\uff0c\u5e76\u4e14\u5f71\u54cd\u9762\u5f88\u5c0f\uff08\u53ea\u5bf9\u5f53\u524d\u7ec8\u7aef\u6709\u6548\uff0c\u9000\u51fa\u5c31\u4e0d\u884c\u4e86\uff09\u3002\n\u5982\u679c\u4f60\u7528\u7684\u662fss\u4ee3\u7406\uff0c\u5728\u5f53\u524d\u7ec8\u7aef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u90a3\u4e48wgetcurl \u8fd9\u7c7b\u7f51\u7edc\u547d\u4ee4\u90fd\u4f1a\u7ecf\u8fc7ss\u4ee3\u7406\nexport ALL_PROXY=socks5:\/\/127.0.0.1:1080\n\n\u5220\u9664\nunset ALL_PROXY\n<\/code><\/pre>\n\n\n\n<p>\u65b9\u6cd52:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u65b9\u6cd52:\n\u628a\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\u5199\u5165shell\u914d\u7f6e\u6587\u4ef6.bashrc\u6216\u8005.zshrc\n\u76f4\u63a5\u5728.bashrc\u6216\u8005.zshrc\u6dfb\u52a0\u4e0b\u9762\u5185\u5bb9\nexport http_proxy=\"http:\/\/localhost:port\"\nexport https_proxy=\"http:\/\/localhost:port\"\n\u4ee5\u4f7f\u7528shadowsocks\u4ee3\u7406\u4e3a\u4f8b\uff0css\u7684\u4ee3\u7406\u7aef\u53e3\u4e3a1080,\u90a3\u4e48\u5e94\u8be5\u8bbe\u7f6e\u4e3a\nexport http_proxy=\"socks5:\/\/127.0.0.1:1080\"\nexport https_proxy=\"socks5:\/\/127.0.0.1:1080\"\n\u6216\u8005\u76f4\u63a5\u8bbe\u7f6eALL_PROXY\nexport ALL_PROXY=socks5:\/\/127.0.0.1:1080\nlocalhost\u5c31\u662f\u4e00\u4e2a\u57df\u540d\uff0c\u57df\u540d\u9ed8\u8ba4\u6307\u5411 127.0.0.1\uff0c\u4e24\u8005\u662f\u4e00\u6837\u7684\u3002\n\u7136\u540eESC\u540e:wq\u4fdd\u5b58\u6587\u4ef6\uff0c\u63a5\u7740\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\nsource ~\/.bashrc\n\u6216\u8005\u9000\u51fa\u5f53\u524d\u7ec8\u7aef\u518d\u8d77\u4e00\u4e2a\u7ec8\u7aef\u3002 \u8fd9\u4e2a\u529e\u6cd5\u7684\u597d\u5904\u662f\u628a\u4ee3\u7406\u670d\u52a1\u5668\u6c38\u4e45\u4fdd\u5b58\u4e86\uff0c\u4e0b\u6b21\u5c31\u53ef\u4ee5\u76f4\u63a5\u7528\u4e86\u3002\n\u6216\u8005\u901a\u8fc7\u8bbe\u7f6ealias\u7b80\u5199\u6765\u7b80\u5316\u64cd\u4f5c\uff0c\u6bcf\u6b21\u8981\u7528\u7684\u65f6\u5019\u8f93\u5165setproxy\uff0c\u4e0d\u7528\u4e86\u5c31unsetproxy\u3002\n aliassetproxy=\"export ALL_PROXY=socks5:\/\/127.0.0.1:1080\"\n aliasunsetproxy=\"unset ALL_PROXY\"\n aliasip=\"curl -i http:\/\/ip.cn\"\n<\/code><\/pre>\n\n\n\n<p>\u65b9\u6cd53:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u65b9\u6cd53:\n\u6539\u76f8\u5e94\u5de5\u5177\u7684\u914d\u7f6e\uff0c\u6bd4\u5982apt\u7684\u914d\u7f6e\nsudo vim \/etc\/apt\/apt.conf\n\u5728\u6587\u4ef6\u672b\u5c3e\u52a0\u5165\u4e0b\u9762\u8fd9\u884c\n1 Acquire::http::Proxy \"http:\/\/proxyAddress:port\"\n\u4fdd\u5b58apt.conf\u6587\u4ef6\u5373\u53ef\u3002\n\u5173\u4e8eapt\u7684\u4ee3\u7406\u8bbe\u7f6e\u53ef\u4ee5\u53c2\u8003\u8fd9\u91cc\n\u5173\u4e8egit\u7684\u4ee3\u7406\u8bbe\u7f6e\u770b\u8fd9\u91cc:\u7528shadowsocks\u52a0\u901fgit clone\n<\/code><\/pre>\n\n\n\n<p>\u65b9\u6cd54(\u63a8\u8350):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u65b9\u6cd54(\u63a8\u8350):\n\u5229\u7528proxychains\u5728\u7ec8\u7aef\u4f7f\u7528socks5\u4ee3\u7406\n\u8865\u5145\uff1a\n\u5982\u679c\u4ee3\u7406\u670d\u52a1\u5668\u9700\u8981\u767b\u9646\uff0c\u8fd9\u65f6\u53ef\u4ee5\u76f4\u63a5\u628a\u7528\u6237\u540d\u548c\u5bc6\u7801\u5199\u8fdb\u53bb\nhttp_proxy=http:\/\/userName:password@proxyAddress:port\n\u914d\u7f6eproxychains\n\u7f16\u8f91\/etc\/proxychains.conf\uff0c\u6700\u4e0b\u9762\u6709\u4e00\u884csocks4 127.0.0.1 9050\uff0c\u628a\u8fd9\u4e00\u884c\u6ce8\u91ca\u6389\uff0c\u6dfb\u52a0\u4e00\u884csocks5 127.0.0.1 1080\n\u6d4b\u8bd5\nproxychains curl www.google.com\n\n\u5982\u679c\u80fd\u770b\u5230\u4e00\u5806\u8f93\u51fa\uff0c\u8bf4\u660e\u8bbe\u7f6e\u6210\u529f\uff0c\u5982\u679c\u4e00\u76f4\u7b49\u5f85\u6216\u8005\u65e0\u6cd5\u8bbf\u95ee\u5219\u4ee3\u8868\u8bbe\u7f6e\u5931\u8d25\u3002\n\u4f7f\u7528\n\u7528\u547d\u4ee4\u884c\u542f\u52a8\u8f6f\u4ef6\uff0c\u5728\u524d\u9762\u52a0\u4e0aproxychains\uff0c\u5982\uff1a\nproxychains firefox\n\n\u4f7f\u7528shadowsocks+proxychains\u4ee3\u7406\u6253\u5f00\u65b0\u7684firefox\u5b9e\u73b0\u6d4f\u89c8\u5668\u7ffb\u5899\u3002 \n\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165proxychains bash\u5efa\u7acb\u4e00\u4e2a\u65b0\u7684shell\uff0c\u57fa\u4e8e\u8fd9\u4e2ashell\u8fd0\u884c\u7684\u6240\u6709\u547d\u4ee4\u90fd\u5c06\u4f7f\u7528\u4ee3\u7406\u3002\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">ssh\u4ee3\u7406<\/h2>\n\n\n\n<p>\u901a\u8fc7\u4fee\u6539ssh\u914d\u7f6e\u6587\u4ef6\u540c\u65f6\u5c06\u6574\u4e2a\u7cfb\u7edf\u7684ssh\u8fde\u63a5\u8d70\u4ee3\u7406<\/p>\n\n\n\n<p>nc \u8fd9\u4e2a\u5de5\u5177\u4e00\u822c\u7684Ubuntu\u7cfb\u7edf\u90fd\u5e26\u7684\u6709.\u6ca1\u6709\u7684\u8bdd<code>apt insttall nc<\/code>,Mac\u4f7f\u7528<code>brew install nc<\/code>\u6dfb\u52a0\u4ee3\u7406<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># ServerAliveInterval\u5b9a\u65f6\u5411\u670d\u52a1\u5668\u53d1\u9001\u6d88\u606f\u4ee5\u4fdd\u6301\u8fde\u63a5,\u9632\u6b62\u4e0d\u64cd\u4f5c\u800c\u65ad\u5f00.\u9700\u8981\u7684\u65f6\u5019\u624d\u6dfb\u52a0\necho \"ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p\" &gt;&gt; ~\/.ssh\/config\necho \"ServerAliveInterval 30\" &gt;&gt; ~\/.ssh\/config\n<\/code><\/pre>\n\n\n\n<p>\u53d6\u6d88\u4ee3\u7406<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sed '\/ProxyCommand\/d' ~\/.ssh\/config  &gt; ~\/.ssh\/config.bk &amp;&amp; mv ~\/.ssh\/config.bk   ~\/.ssh\/config\n# \u6216\u8005\nsed '\/ProxyCommand\/d;\/ServerAliveInterval\/d' ~\/.ssh\/config  &gt; ~\/.ssh\/config.bk &amp;&amp; mv ~\/.ssh\/config.bk   ~\/.ssh\/config<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u81ea\uff1ahttp:\/\/www.voycn.com\/article\/ubunturangzhongduanzou&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":149,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,4],"tags":[17,15],"class_list":["post-143","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips","category-article","tag-linux","tag-ubuntu"],"_links":{"self":[{"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=143"}],"version-history":[{"count":2,"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions"}],"predecessor-version":[{"id":151,"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions\/151"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=\/wp\/v2\/media\/149"}],"wp:attachment":[{"href":"http:\/\/jemlab.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jemlab.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}