Skip to content

Instantly share code, notes, and snippets.

@ranomier
ranomier / README-setup-tunnel-as-systemd-service.md
Last active June 14, 2023 01:54
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host: (If you want a reverse tunnel change the -L to -R and name the file .../secure-reverse-tunnel@.service)

[Unit]
Description=Setup a secure tunnel to %I
After=network.target

[Service]