Skip to content

OpenSSH

Port of OpenBSD's free SSH release https://www.openssh.com/

Setup a SOCKS5 proxy

Start a SOCKS5 proxy: ssh -C -D 1080 -N -q -A -p 22 my-user@my-host

Test proxy server via cURL: curl --socks5 localhost:1080 httpbin.org/ip

Setup a SOCKS5 proxy with auto-restart

autossh — monitor and restart ssh sessions

Install the autossh util

shell
# Ubuntu
apt install autossh

# macOS
brew install autossh

Start a SOCKS5 proxy: autossh -M20000 -f -C -D 1080 -N -q -A -p 22 my-user@my-host

Notes on options

-M specifies the base monitoring port to use.
-f causes autossh to drop to the background before running ssh. 

-C Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11, TCP and Unix-domain connections). 
-D [bind_address:]port Specifies a local "dynamic" application-level port forwarding.  
-N Do not execute a remote command.
-q Quiet mode. Causes most warning and diagnostic messages to be suppressed.
-A Enables forwarding of connections from an authentication agent such as ssh-agent(1). 
-p Port to connect to on the remote host. 

Released under the CC-BY-NC-4.0