HostOnNet Blog

How to setup shadowsocks Proxy on Ubuntu

Looking for Linux Server Admin or WordPress Expert? We can help.

shadowsocks is a socks5 proxy server. Unlike Most other socks5 proxy software, shadowsocks require client side software installed for socks5 proxy to work.

Installing shadowsocks

This need to be done on server and client.

sudo apt install python-pip python-m2crypto
sudo pip install shadowsocks

Configuring shadowsocks as server

ssserver is the shadowsocks server. To configure, create file

vi /etc/shadowsocks.json

Put following content in it

{
"server":"YOUR_SERVER_PUBLIC_IP_HERE",
"server_port":8044,
"local_port":0,
"password":"YOUR_PASSWORD_HERE",
"timeout":600,
"method":"aes-256-cfb"
}

In the above, replace your server ip and password. server_port can be changed if you want to use a different port, that is not required.

To start server, run

sudo ssserver -c /etc/shadowsocks.json -d start

You can stop server using

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

You can verify shadowsocks server is running using netstat

root@hon-vpn:~# netstat -an | grep 8044
tcp        0      0 198.50.234.187:8044     0.0.0.0:*               LISTEN     
udp        0      0 198.50.234.187:8044     0.0.0.0:*                          
root@hon-vpn:~# 

Log file available at

tail -f /var/log/shadowsocks.log 

Connecting to shadowsocks server

To connect to shadowsocks server, you need to install client. There are many clients available for different operating systems. You can find more details at

https://shadowsocks.org/en/download/clients.html

shadowsocks come with sslocal command line client.

Configure sslocal to connect to shadowsocks server

Configuring sslocal is same as configuring your server. Create file

sudo vi /etc/shadowsocks.json

With following content

{
    "server":"SERVER_IP",
    "server_port":8044,
    "local_address": "127.0.0.1",
    "local_port":7070,
    "password":"SERVER_PASSWORD",
    "timeout":600,
    "method":"aes-256-cfb"
}

Replace SERVER_IP and SERVER_PASSWORD with what you have in your server configuration.

Now start client with command

sudo sslocal -c /etc/shadowsocks.json -d start

You can stop sslocal with

sudo sslocal -c /etc/shadowsocks.json -d stop

Above commands run shadowsocks as deamon, if you just want to run for debug purpose, use

sudo sslocal -c /etc/shadowsocks.json

Configuring Browser

You can set your browser to connect using socks proxy, use 127.0.0.1:7070 as your proxy server.

Here is the settings for firefox browser.

Start shadowsocks on boot

Edit /etc/rc.local and add

On server

ssserver -c /etc/shadowsocks.json -d start

On client

sslocal -c /etc/shadowsocks.json -d start

See Proxy

Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.