If you're somewhere that has a network that is partly blocked, but allows SSH, or if you are in a coffee shop or something similar and are worried about security, you can setup a SOCKS proxy to route all your traffic via a remote server that you control, and then out onto the Internet.
Setup SOCKS proxy
First, you need to SSH to the remote machine with some special parameters:
ssh -vND 8888 firstname.lastname@example.org
Some detail on those options:
-v verbose mode; useful for debugging -N don't start an interactive shell on the remote server -D setup the SOCKS proxy on port 8888 on localhost
#!/bin/bash while [ '' == '' ] do ping -q -c5 baidu.com > /dev/null if [ $? -eq 0 ] then ssh_d_process_num=`ps aux|grep -E 'ssh \-' |grep -v grep |wc -l` if [ $ssh_d_process_num == 0 ]; then /usr/local/bin/sshpass -p "654321" ssh -ND 8080 sshuser@server & fi fi sleep 60 done
关于如何安装 sshpass 命令，点击传送门：https://gist.github.com/arunoda/7790979