Skip to content

Instantly share code, notes, and snippets.

@mortie
Created November 11, 2024 14:42
Show Gist options
  • Save mortie/e5e8b487115b0fcd369495afda91fb39 to your computer and use it in GitHub Desktop.
Save mortie/e5e8b487115b0fcd369495afda91fb39 to your computer and use it in GitHub Desktop.
SSH service for creating a reverse SSH tunne
[Unit]
Description=Create reverse SSH tunnel
[Service]
User=martin
ExecStart=/usr/bin/autossh -N -T -o 'ServerAliveInterval 10' -o 'ServerAliveCountMax 2' -R 0.0.0.0:<SERVER PORT>:localhost:22 <SERVER>
Restart=always
RestartSec=5s
[Install]
WantedBy=network-online.target
@mortie
Copy link
Author

mortie commented Nov 11, 2024

Depends on autossh: apt install autossh

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