Written by
Martin
on
on
Systemd service to run autossh
If you have some devices behind a firewall or NAT (like most home networks) but want to access it from the outside you can use the autossh tool to continually expose their local sshd to a server running on the public internet.
# /etc/systemd/services/autossh-sshd.service
[Unit]
Description=Exposes the local sshd through an ssh tunnel
After=network.target
[Service]
User=xxx
ExecStart=/usr/bin/autossh -N -T -R localhost:62000:localhost:22 user@yourserver.tld
[Install]
WantedBy=multi-user.target