<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="https://www.bigdick.live/feed_style.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans">
    <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
        <tabi:base_url>https:&#x2F;&#x2F;www.bigdick.live</tabi:base_url>
        <tabi:separator>
            •
        </tabi:separator>
        <tabi:about_feeds>这是Web Feed，又称为Atom Feed，把现在的网址复制到新闻阅读器即可订阅本站文章。造访「About Feeds」来了解更多资讯。</tabi:about_feeds>
        <tabi:visit_the_site>造访网站</tabi:visit_the_site>
        <tabi:recent_posts>近期文章</tabi:recent_posts>
        <tabi:last_updated_on>更新于 $DATE</tabi:last_updated_on>
        <tabi:default_theme></tabi:default_theme>
        <tabi:post_listing_date>date</tabi:post_listing_date>
        <tabi:current_section>计算机网络</tabi:current_section>
    </tabi:metadata><link rel="extra-stylesheet" href="https://www.bigdick.live/skins/black-orange.css?h=c64b7f81e34a143cd725" /><title>孙瑜 - 计算机网络</title>
        <subtitle>孙瑜的个人首页：生物信息、数据科学、软件工程，以及公开简历、项目和文章。</subtitle>
    <link href="https://www.bigdick.live/tags/ji-suan-ji-wang-luo/atom.xml" rel="self" type="application/atom+xml"/>
    <link href="https://www.bigdick.live/tags/ji-suan-ji-wang-luo/" rel="alternate" type="text/html"/>
    <generator uri="https://www.getzola.org/">Zola</generator><updated>2018-12-22T00:00:00+00:00</updated><id>https://www.bigdick.live/tags/ji-suan-ji-wang-luo/atom.xml</id><entry xml:lang="zh-Hans">
        <title>如何克服开启中大代理后访问外网资源失败的问题</title>
        <published>2018-12-22T00:00:00+00:00</published>
        <updated>2018-12-22T00:00:00+00:00</updated>
        <author>
            <name>孙瑜</name>
        </author>
        <link rel="alternate" href="https://www.bigdick.live/blog/sysu-proxy-zh/" type="text/html"/>
        <id>https://www.bigdick.live/blog/sysu-proxy-zh/</id>
        
            <content type="html">&lt;p&gt;中大的睿智代理，一直有这个&lt;strong&gt;用了代理就没办法访问任何校外互联网资源&lt;&#x2F;strong&gt;的奇奇怪怪的毛病。对于一个经常需要在家工作的计算狗而言，这实在太不友好了。这里详细记录一下使用超低系统资源（&amp;lt;50MB RAM， CPU占用≈0%）解决这个问题。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;zhi-xie&quot;&gt;致谢&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;感谢德华君提供这个野路子以及过程中的指导&lt;&#x2F;li&gt;
&lt;li&gt;感谢Nick湿胸借用上网账号&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;da-zhi-si-lu&quot;&gt;大致思路&lt;&#x2F;h2&gt;
&lt;p&gt;不清楚是NAT啊，还是DNS服务更改的问题，总之这个代理只要使用了，再想使用互联网的资源就崩了，因此克服这个问题的唯一办法就是，&lt;strong&gt;在访问外网的时候关掉代理&lt;&#x2F;strong&gt;。但是Windows下通过IE浏览器登录代理，使用的是EasyConnect客户端，断了似乎就是断了，网页再认证还需要&lt;strong&gt;输入验证码&lt;&#x2F;strong&gt;。&lt;&#x2F;p&gt;
&lt;p&gt;所以需要曲线救国，即&lt;strong&gt;访问外网资源的时候不走代理直接连接&lt;&#x2F;strong&gt;。咦？这和我们科学上网的需求好相似！你总不想打开国内页面的时候也绕路走你的国外VPS吧！那么为什么不用shadowsocks解决这个问题呢？&lt;&#x2F;p&gt;
&lt;p&gt;因此最后解决问题的路线就是：&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;虚拟机内开启学校代理并开启服务&lt;&#x2F;li&gt;
&lt;li&gt;虚拟机上架设shadowsocks server端并开启服务&lt;&#x2F;li&gt;
&lt;li&gt;本机使用shadowsocks client&lt;&#x2F;li&gt;
&lt;li&gt;本地使用校内代理的两种情况：
&lt;ul&gt;
&lt;li&gt;对于网页（比如RStudio server）使用Chrome浏览器的SwitchyOmega插件&lt;&#x2F;li&gt;
&lt;li&gt;SSH和SFTP连接直接使用配置了代理的Xshell和Xftp&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;an-zhuang-xu-ni-ji&quot;&gt;安装虚拟机&lt;&#x2F;h2&gt;
&lt;p&gt;先下载一个虚拟机程序，建议用VM Virtualbox，虽然据说VMware的硬件兼容好点，但是我的目的简单，只是在后台run一个Linux用来使用代理而已，因此这个轻量级的软件比较适合。操作系统使用Ubuntu Server 18.04：&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;我们不需要图形界面&lt;&#x2F;li&gt;
&lt;li&gt;Ubuntu的LTS是最稳定的Server操作系统之一&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;虚拟机的配置上，RAM可以随便给个100M+（不会真的用完的，host消耗很小），硬盘就用那个vdi文件动态分配就好，那么大小也就无所谓了（理论上动态分配会稍微影响点IO性能，但是和我们的主题无关）。&lt;&#x2F;p&gt;
&lt;p&gt;命令行安装操作系统可能有点蛋疼，但是基本上也是一路选下一步就可以的。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;xu-ni-ji-linuxpei-zhi&quot;&gt;虚拟机Linux配置&lt;&#x2F;h2&gt;
&lt;p&gt;这个时候，还是先装好Xshell吧，不要头铁：没有SSH，你就这样在终端里面，你&lt;strong&gt;连一个普通命令的&lt;code&gt;--help&lt;&#x2F;code&gt;返回内容都浏览不全&lt;&#x2F;strong&gt;；想复制个URL却发现&lt;strong&gt;没得复制粘贴&lt;&#x2F;strong&gt;，浑身难受。Ubuntu Server默认是开了22端口的，也开启了sshd服务，所以&lt;code&gt;ifconfig&lt;&#x2F;code&gt;查到IP直接就可以连了。虚拟机的网络设置可以有以下两种策略：&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;桥接模式：和host在一个网段&lt;&#x2F;li&gt;
&lt;li&gt;NAT模式：需要端口映射，在本例中，你至少需要映射22端口用作ssh，再映射一个shadowsocks用的端口。&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;搞定了之后，就陆陆续续安装一下必要工具：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; apt-get update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; apt-get dist-upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; apt install openconnect&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; apt-get install python-pip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pip install shadowsocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;使用openconnect需要一个厉害的配置文件vpnc-script，可以用&lt;code&gt;wget&lt;&#x2F;code&gt;从&lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;openconnect&#x2F;vpnc-scripts&#x2F;-&#x2F;raw&#x2F;master&#x2F;vpnc-script&quot;&gt;这里&lt;&#x2F;a&gt;下载。你应该到现在为止没有切换过当前tty的工作目录，那漂亮啊，就下载到这吧，用起来也方便…&lt;&#x2F;p&gt;
&lt;p&gt;然后开启openconnect服务：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; openconnect -b --no-dtls --script ~&#x2F;vpnc-script https:&#x2F;&#x2F;ocvpn.sysu.edu.cn --servercert sha256:a0cc6612c7310494b31ad62e76255373f056ac128c8489ac58562f6fe57ae8e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;--servercert&lt;&#x2F;code&gt;参数值是双鸭山大学提供的证书。你可以不加上这个参数，但是它会逼着你加上。&lt;&#x2F;p&gt;
&lt;p&gt;输入用户名和密码，程序会返回一个PID之后在后台运行。&lt;&#x2F;p&gt;
&lt;p&gt;接下来开启shadowsocks服务：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ssserver -p&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-numeric&quot;&gt; 2333&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -k&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-numeric&quot;&gt; 930829&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -m rc4-md5 -d start&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;我比较懒，就直接这样开启SS服务而不是写配置文件了：&lt;code&gt;-p&lt;&#x2F;code&gt;是端口；&lt;code&gt;-k&lt;&#x2F;code&gt;是密码我用了自己生日，你们可以随意；&lt;code&gt;-m&lt;&#x2F;code&gt;是加密方法，我X我和我虚拟机连接我丝毫不虚，选个复杂度低的速度快点负荷小点；&lt;code&gt;-d&lt;&#x2F;code&gt;如果替换成stop就是停止服务。&lt;&#x2F;p&gt;
&lt;p&gt;在Ubuntu Server 18.04上，你可能会遇到这样一个错误：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# 此处省略99999行&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AttributeError: &#x2F;usr&#x2F;lib&#x2F;x86_64-linux-gnu&#x2F;libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;这是由于在openssl 1.1.0中废弃了 &lt;code&gt;EVP_CIPHER_CTX_cleanup()&lt;&#x2F;code&gt; 函数而引入了 &lt;code&gt;EVE_CIPHER_CTX_reset()&lt;&#x2F;code&gt; 函数所导致的。&lt;&#x2F;p&gt;
&lt;p&gt;解决方式也是简单，直接找到使用的openssl.py文件（&lt;strong&gt;我省略的那部分异常信息里就有它的位置&lt;&#x2F;strong&gt;），把里面的所有cleanup字样全部替换为reset，就舒服了。直接&lt;code&gt;vim&lt;&#x2F;code&gt;里面批量替换，别问我怎么操作，问就是不告诉你。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;wo-yao-zen-me-shi-yong-xu-ni-ji-li-mian-de-dai-li-ni&quot;&gt;我要怎么使用虚拟机里面的代理呢&lt;&#x2F;h2&gt;
&lt;p&gt;首先，你需要&lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;shadowsocks&#x2F;shadowsocks-windows&quot;&gt;shadowsocks client&lt;&#x2F;a&gt;来把代理服务器的shadowsocks协议转发为socks5协议。你可能需要在两个不同的目录运行两个独立的shadowsocks进程（端口各自不同），以方便同时使用科学上网和虚拟机中架设的中大代理。&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fang-wen-wang-ye&quot;&gt;访问网页&lt;&#x2F;h3&gt;
&lt;p&gt;比如RStudio server，比如hugo的预览，都是要访问内网网页的。使用Chrome浏览器的SwitchyOmega插件，可以妥善解决这个问题。记得在auto switch里面，将使用中大代理的情景模式的触发条件&lt;strong&gt;用带有通配符的IP设置为同一网段&lt;&#x2F;strong&gt;。&lt;&#x2F;p&gt;
&lt;h3 id=&quot;shi-yong-sshlian-jie&quot;&gt;使用SSH连接&lt;&#x2F;h3&gt;
&lt;p&gt;在Xshell的连接属性里面设置好使用代理（注意端口）。&lt;&#x2F;p&gt;
&lt;p&gt;至此，科学上网&#x2F;直连&#x2F;中大代理可以和睦相处了。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;bu-chong&quot;&gt;补充&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;wo-xu-yao-yi-ge-service&quot;&gt;我需要一个service&lt;&#x2F;h3&gt;
&lt;p&gt;理想状态下，应该是虚拟机开机自动运行这个openconnect命令的，然后如果崩溃可以自动恢复，所以要把它做成一个service的形式比较好。Ubuntu的这些service一般在&lt;code&gt;&#x2F;lib&#x2F;systemd&#x2F;system&#x2F;&lt;&#x2F;code&gt;，所以在这里面操作吧：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support z-function z-builtin&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;lib&#x2F;systemd&#x2F;system&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; touch sysu-proxy.service&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;然后填内容进去：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[Unit]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Description=sysu-proxy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;After=network.target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StartLimitIntervalSec=0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StartLimitAction=reboot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[Service]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Type=simple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Restart=always&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RestartSec=1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;User=ysun&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ExecStart=&#x2F;bin&#x2F;echo &amp;#39;passwd&amp;#39; | &#x2F;usr&#x2F;sbin&#x2F;openconnect --no-dtls --script ~&#x2F;vpnc-script https:&#x2F;&#x2F;ocvpn.sysu.edu.cn --servercert sha256:a0cc6612c7310494b31ad62e76255373f056ac128c8489ac58562f6fe57ae8e9 -u username&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[Install]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;WantedBy=multi-user.target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;这里面要解释一下的：&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Restart=always&lt;&#x2F;code&gt;可以保证进程挂了就自动重新运行&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RestartSec=1&lt;&#x2F;code&gt;一旦挂了，它就会不断尝试重新运行，那么为了防止某些特定情况下一直重新运行增加服务器负载，还是间隔设置久一点好点（间隔为1秒）&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ExecStart=...&lt;&#x2F;code&gt;对于需要交互式输入密码的，可以用这个技巧，通过管道将特定字符传过去&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;StartLimitIntervalSec=0&lt;&#x2F;code&gt;是防止放弃重新运行的。理论上是这样：还有一个参数值，比如&lt;code&gt;StartLimitBurst=5&lt;&#x2F;code&gt;，同时再有&lt;code&gt;StartLimitIntervalSec=10&lt;&#x2F;code&gt;的话呢，那么就如果在10秒内失败了5次，就放弃运行了（何弃疗！）防止这个情况发生就可以这样设置为0&lt;&#x2F;li&gt;
&lt;li&gt;其实&lt;code&gt;[Unit]&lt;&#x2F;code&gt;还可以加上&lt;code&gt;StartLimitAction=reboot&lt;&#x2F;code&gt;如果上面设置不是0，崩了，还是可以通过这个方式重启操作系统&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;好了，接下来就很舒服了：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; systemctl enable sysu-proxy.service&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; systemctl daemon-reload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; systemctl restart sysu-proxy.service&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
        </entry><entry xml:lang="zh-Hans">
        <title>Git该如何免密码提交？</title>
        <published>2018-06-27T00:00:00+00:00</published>
        <updated>2018-06-27T00:00:00+00:00</updated>
        <author>
            <name>孙瑜</name>
        </author>
        <link rel="alternate" href="https://www.bigdick.live/blog/gitmian-mi-ma-zh/" type="text/html"/>
        <id>https://www.bigdick.live/blog/gitmian-mi-ma-zh/</id>
        
            <content type="html">&lt;p&gt;早年的时候比较迷，看到GitHub上的ssh key和repo的ssh地址总是傻傻不知道有什么用…然后使用GitLab的private仓库的时候因为强制要求使用ssh key感到很迷茫（因为在GitHub根本用不起）（什么？Student Pack？）（什么？不知道5个根本不够用吗2333333）。今天终于抽点时间解释一下来给后人看。&lt;&#x2F;p&gt;
&lt;p&gt;直到前阵子幡然醒悟，md老子这么久以来为什么一直在用账号密码提交代码？&lt;&#x2F;p&gt;
&lt;p&gt;本文中就不以CMD举例了，反正看这个东西的人，你肯定有一个git bash，这比CMD好用n倍，那么命令都是一样的。&lt;&#x2F;p&gt;
&lt;p&gt;先查看当前用户有已经生成的ssh公钥吗：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ~&#x2F;.ssh&#x2F;id_rsa.pub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;如果没有，从头生成一个：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;ssh-keygen&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-punctuation z-definition z-string&quot;&gt; -C &amp;quot;你可以写邮箱，但是无所谓，不加这个参数都无所谓&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;嗯，就是这么简单，对于普通用户而言，什么&lt;code&gt;-t&lt;&#x2F;code&gt;啊&lt;code&gt;-b&lt;&#x2F;code&gt;啊，忘了它们吧。
中间还会提示你选个路径&#x2F;文件名去存放这个key，无所谓，默认最好了，方便。
中间还会提示你输入一个“短语”，我去你*的短语，这就是密码啊…这个可能得找个小本本悄悄记下来了hhhhh，一路回车，然后再来一轮：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;cat&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ~&#x2F;.ssh&#x2F;id_rsa.pub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;是不是有内容了！是不是敲厉害！默默把标准输出复制下来吧！&lt;&#x2F;p&gt;
&lt;p&gt;然后去GitHub（当然GitLab什么的同理啦）找到设置再找到SSH key那项，选择New（账户设置啊，别去repo设置玩半天），把之前复制的内容贴进去。写个妥善的Title（比如这是你何年何月何日在何地结缘的电脑，网吧什么的你还是别搞什么SSH key这种幺蛾子了），让自己记住是干嘛用的。&lt;&#x2F;p&gt;
&lt;p&gt;好了，这个时候估计你就会和以前的我一样开始玩蛋：
兴高采烈地push了一波发现输入账号和密码的提示又出来了！
因为你其实之前就是通过https方式访问repo的，改成ssh就好了，比如这样：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;git&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; remote rm origin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;git&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; remote add origin git@你那个仓库的地址（详见下图）.git&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;当然，如果你之前没有clone过仓库，那就直接从git地址克隆就没毛病了。&lt;&#x2F;p&gt;
&lt;p&gt;之后再push就无痛了。&lt;&#x2F;p&gt;
</content>
        </entry><entry xml:lang="zh-Hans">
        <title>如何优雅地在Linux操作系统下翻墙（客户端篇）</title>
        <published>2018-05-29T00:00:00+00:00</published>
        <updated>2018-05-29T00:00:00+00:00</updated>
        <author>
            <name>孙瑜</name>
        </author>
        <link rel="alternate" href="https://www.bigdick.live/blog/linuxfan-qiang-zh/" type="text/html"/>
        <id>https://www.bigdick.live/blog/linuxfan-qiang-zh/</id>
        
            <content type="html">&lt;p&gt;本文主要介绍如何在Arch Linux下部署client端的SS，考虑到主要也是国人才有这种需求，就直接丢中文版blog了。&lt;&#x2F;p&gt;
&lt;p&gt;废话少说，&lt;code&gt;shadowsocks-libev&lt;&#x2F;code&gt;是C语言编写的轻量版的SS。先安装：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman -S shadowsocks-libev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;写好配置文件（具体写法就见&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;break-through-gfw&#x2F;&quot;&gt;英文版教程&lt;&#x2F;a&gt;吧，几乎一致的）：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; mkdir &#x2F;etc&#x2F;shadowsocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-comment&quot;&gt;# 我理你用nano还是vim还是个什么鬼，就编辑一下文本文件嘛&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-comment&quot;&gt;# 做人呢，最紧要是开心&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; vim &#x2F;etc&#x2F;shadowsocks&#x2F;config.json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;使用&lt;code&gt;systemctl&lt;&#x2F;code&gt;管理ss的daemon进程（这个在介绍&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;working-on-linux&#x2F;&quot;&gt;Manjaro Linux的使用&lt;&#x2F;a&gt;的时候提过）：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-comment&quot;&gt;# 配置文件的前缀名为config，因此此处为@config&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; systemctl enable shadowsocks-libev@config&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; systemctl daemon-reload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; systemctl start shadowsocks-libev@config&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;最后，使用&lt;code&gt;proxychains-ng&lt;&#x2F;code&gt;做socks5转发。&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;插嘴一句，本身就是齐胖胖他们医院的网络爆炸，所以只好搞这样一出来安装RStudio Server。没想到回到博士课题组修电脑还是用到了hhhhh&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;先用命令&lt;code&gt;sudo pacman -S proxychains-ng&lt;&#x2F;code&gt;安装，然后同样也要写配置，就很简单了，直接&lt;code&gt;sudo vim &#x2F;etc&#x2F;proxychains.conf&lt;&#x2F;code&gt;编辑，把原来&lt;code&gt;[ProxyList]&lt;&#x2F;code&gt;下面的内容去掉，加上&lt;code&gt;socks5 127.0.0.1 1080&lt;&#x2F;code&gt;。&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;proxychains-ng的输出非常烦躁…如果觉得眼睛花，在刚刚的配置文件里面有一行&lt;code&gt;quietmode&lt;&#x2F;code&gt;，把前面的注释取消掉就好了。&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;接下来就是使用了。只要在需要使用代理的命令前面加上&lt;code&gt;proxychains4&lt;&#x2F;code&gt;就可以，比如&lt;code&gt;proxychains4 aurman -S rstudio-server-bin&lt;&#x2F;code&gt;这样。&lt;&#x2F;p&gt;
</content>
        </entry>
</feed>
