Skip to content

Instantly share code, notes, and snippets.

@jsupa
Last active September 9, 2022 14:22
Show Gist options
  • Save jsupa/2ce0feba2985ba96c421e30d408682bb to your computer and use it in GitHub Desktop.
Save jsupa/2ce0feba2985ba96c421e30d408682bb to your computer and use it in GitHub Desktop.
ssh reverse tunnel
[Unit]
Description=SSH reverse tunnel
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/ssh -g -N -T -o VerifyHostKeyDNS=no  -o "ServerAliveInterval 10" -o StrictHostKeyChecking=no -o "ExitOnForwardFailure yes" -R xxxx:localhost:xxxx xx@xxxx -i /home/xxxx/.ssh/id_rsa
Restart=always
RestartSec=5s

[Install]
WantedBy=default.target

/etc/systemd/system

sudo systemctl enable sudo systemctl start sudo systemctl status

sudo lsof -i -P -n | grep LISTEN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment