ourfor / blog

利用GitHub的Issues记录
https://github.com/ourfor/blog/issues
1 stars 0 forks source link

SSH创建socks5服务 #113

Open ourfor opened 4 months ago

ourfor commented 4 months ago
# machine B is proxy_server, you want to browser by machine B network
ssh -D 1337 -q -C -N proxy_server
# machine A .zshrc
function setproxy() {
    export http_proxy=socks5h://127.0.0.1:1337
    export https_proxy=socks5h://127.0.0.1:1337
}

function unsetproxy() {
    unset http_proxy https_proxy
}
ourfor commented 4 months ago
[Unit]
Description=SSH socks5 proxy

[Service]
Type=simple
ExecStart=/bin/sh -c "ssh -D 1337 -q -C -N proxy_server"
Restart=always
RestartSec=10
User=root
Group=root

[Install]
WantedBy=multi-user.target
ourfor commented 4 months ago
while true; do ssh -D 1337 -q -C -N proxy_server; done