Skip to content

Instantly share code, notes, and snippets.

@hamid-rostami
Last active November 30, 2019 18:54
Show Gist options
  • Save hamid-rostami/bb22b7cd54232e55ee6991ca05dd1ad7 to your computer and use it in GitHub Desktop.
Save hamid-rostami/bb22b7cd54232e55ee6991ca05dd1ad7 to your computer and use it in GitHub Desktop.
Add ngrok to systemd
  1. Add ngrok.service to /etc/systemd/system directory
  • At section ExecStart replace /path/of/executable/ngrok with full path of ngrok executable downloaded from ngrok website

  • Replace USER with your user account

  1. Add ngrok.yml to /home/USER/.ngrok2 directory
  • Replace TOEKN with your token from ngrok.com dashboard
  1. Start service:

systemctl start ngrok

  1. Enable service at boot time:

systemctl enable ngrok

  1. See your address at status section of your dashboard
[Unit]
Description=ngrok ssh tunnel
After=network.target
[Service]
Type=simple
Restart=always
ExecStart=/path/of/executable/ngrok start --config /home/USER/.ngrok2/ngrok.yml ssh
[Install]
WantedBy=multi-user.target
authtoken:TOKEN
remote_management: null
tunnels:
ssh:
proto: tcp
addr: 22
@miladblg
Copy link

Very useful! You solved one of my problems :)
please add user type in ngrok.service file ;)

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