Skip to content

Instantly share code, notes, and snippets.

@nfvs
Last active January 22, 2024 15:48
Show Gist options
  • Save nfvs/22b81f8a2a796cce5a57abfad4da9bcb to your computer and use it in GitHub Desktop.
Save nfvs/22b81f8a2a796cce5a57abfad4da9bcb to your computer and use it in GitHub Desktop.
Use autossh to setup a local socks5 proxy
[Unit]
Description=AutoSSH socks5 tunnel
After=network-online.target ssh.service
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa -D 0.0.0.0:1080 root@127.0.0.1
ExecStop=/bin/kill $MAINPID
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment