Github (SSH) via public WIFI, port 22 blocked

前端 未结 6 1260
忘了有多久
忘了有多久 2020-12-04 05:11

I\'m currently on a public WIFI spot and I\'m unable to use SSH (they probably blocked that port). However, I need that connection to do a git push.

<         


        
6条回答
  •  抹茶落季
    2020-12-04 05:23

    I find two ways

    First

    • tor + torify

    After successfully Install and configure tor on system simply run this to check ssh use tor.

    torify ssh -Tv git@gitlab.com


    Second

    • tor + privoxy + corkscrew

    First configure tor from fist step. Then install privoxy to convert tor SOCKS5 to HTTP proxy.

    sudo apt install privoxy

    Then install corkscrew

    sudo apt install corkscrew

    Place this config file in: ~/.ssh/config

    host *
        ProxyCommand corkscrew 127.0.0.1 8118 %h %p
    

    Or with ncat

    Host gitlab.com
            User git
            ProxyCommand ncat --proxy 127.0.0.1:8118 %h %p
    

    Also can use nc instead of ncat

        ProxyCommand nc --proxy 127.0.0.1:8118 %h %p
    

    Now ssh can use configured proxy.

    [Edit]

    Simpler version

    Use torify before ssh command.

    torify ssh -Tv git@gitlab.com


    To works with Privoxy+Tor may need to change default configs. For me uncomment this line in /etc/privoxy/config

    forward-socks5t   /               127.0.0.1:9050 .
    

    ssh config

    Host *
        ProxyCommand nc --proxy 127.0.0.1:8118 %h %p
    

提交回复
热议问题