How to setup Shadowsocks on your Ubuntu server

How to setup Shadowsocks on your Ubuntu server

Your school or company network may block the access to a few specific websites. To solve this problem, I'd highly recommend Shadowsocks, since it is the easiest proxy tool I've ever found, and it's FREE (of course iff you have your own server running).

  • First, ssh to your server, and make sure you have Python and pip installed. If you have Python but not pip, install it using the following command

    $ sudo apt-get install python3-pip
    
    1
  • Then, install Shadowsocks using pip

    $ sudo pip install shadowsocks
    
    1

    Create configuration file at /etc/shadowsocks.json, with the following content,

    {
    "server":"[server ip address]",
    "server_port":8388,
    "local_port":0,
    "password":"[password]",
    "timeout":600,
    "method":"aes-256-cfb"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8

    Don't forget to change the [server ip address] and [password] in the block above.

  • Finally, we're ready to start the shadowsocks server that runs in the background by

    $ sudo ssserver -c /etc/shadowsocks.json -d start  ## -d表示在后台运行;如果需要调试可以去掉-d
    
    1

    If you wish to stop the Shadowsocks server, do this

    $ sudo ssserver -c /etc/shadowsocks.json -d stop
    
    1

    To install Shadowsocks client software on your local machine, follow the instruction in this repository on GitHub.

Cheers! Now you don't ever need to curse your school or company Internet administrator for blocking your favorite websites anymore.


  • 一组可用的配置参数如下 (配置多个端口):

{
   "server":"0.0.0.0",   
   "local_address":"127.0.0.1",
   "local_port":1080,
   "port_password": {
        "port_1": "password_1",
        "port_2": "password_2"
    },
   "method":"rc4-md5",
   "timeout":600,
   "fast_open": false,
   "global": true
}
1
2
3
4
5
6
7
8
9
10
11
12
13

赋予文件对应权限:

sudo chmod 755 /etc/shadowsocks.json
1
  • socket.error: [Errno 99] Cannot assign requested address

SOLUTION: Change "server":"XXX.xxx.xxxx" to "server": "0.0.0.0".

Reference

评论