cd ~
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip -P ~
unzip ngrok-stable-linux-amd64.zip
sudo mv ngrok /usr/local/bin/
# To test out ngrok ssh background
ngrok tcp 22 --log=stdout > ~/ngrok.log &
# To copy token goto: https://dashboard.ngrok.com/get-started
ngrok authtoken ...
nano ~/.ngrok2/ngrok.yml
sudo nano /lib/systemd/system/ngrok.service.d/env.conf
sudo nano /lib/systemd/system/ngrok.service
sudo systemctl start ngrok
sudo systemctl enable ngrok
sudo systemctl status ngrok
-
-
Save rahman541/f009cb9e06634befe1eeeb9327fbed4e to your computer and use it in GitHub Desktop.
ngrok / ngrok2 systemd script + config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/systemd/system/ngrok.service.d/env.conf | |
[Service] | |
#which tunnel, or all? | |
Environment="TUNNEL=--all" | |
#log format | |
Environment="LOG_FORMAT=logfmt" | |
#log level | |
Environment="LOG_LEVEL=info" | |
#log file | |
Environment="LOG=/var/log/ngrok.log" | |
#ngrok2 config file (for tunnels/certs etc.) | |
#adjust home directory accordingly | |
Environment="CONFIG=/home/ubuntu/.ngrok2/ngrok.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu: /lib/systemd/system/ngrok.service | |
# Config (env.conf) placed in ngrok.service.d will be read automatically | |
# YMMV on other distributions | |
[Service] | |
PrivateTmp=true | |
Type=simple | |
StandardOutput=journal | |
StandardError=journal | |
ExecStart=/usr/local/bin/ngrok start ${TUNNEL} --log-format ${LOG_FORMAT} --log-level ${LOG_LEVEL} --log ${LOG} --config ${CONFIG} | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.ngrok2/ngrok.yml | |
region: ap | |
tunnels: | |
ssh: | |
proto: tcp | |
addr: 2828 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment