Skip to content

Instantly share code, notes, and snippets.

@itdaniher
Created December 18, 2018 05:49
Show Gist options
  • Save itdaniher/6e21c6454d9faffce49d6d5690138c82 to your computer and use it in GitHub Desktop.
Save itdaniher/6e21c6454d9faffce49d6d5690138c82 to your computer and use it in GitHub Desktop.
sshtunnel service
REMOTE_SSH_PORT_TO_BIND=8192
REMOTE_SSH_KEY_FULLPATH=/etc/sshtunnel.privkey
REMOTE_SSH_IP=255.255.255.255
REMOTE_SSH_USER=root
[Unit]
Description=SSH Tunnel
After=network.target
[Service]
EnvironmentFile=/etc/sshtunnel.conf
Restart=always
RestartSec=20
User=root
ExecStart=/usr/bin/ssh -v -NT -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -R 127.0.0.1:${REMOTE_SSH_PORT_TO_BIND}:127.0.0.1:22 -l ${REMOTE_SSH_USER} -i ${REMOTE_SSH_KEY_FULLPATH} ${REMOTE_SSH_IP}
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment