-
-
Notifications
You must be signed in to change notification settings - Fork 906
Systemd service
Shuanglei Tao edited this page Aug 19, 2020
·
1 revision
In order to have ttyd launch on startup and restart automatically on error, you can create and enable a service file running its binary. Say we've downloaded a binary from the releases page and moved it to /opt
(so its full path is now /opt/ttyd
). paste the following content into /etc/systemd/system/ttyd.service
:
[Unit]
Description=TTYD
After=syslog.target
After=network.target
[Service]
ExecStart=/opt/ttyd login
Type=simple
Restart=always
User=root
Group=root
[Install]
WantedBy=multi-user.target
Now, to start the service and make sure it starts on boot:
sudo systemctl start ttyd && sudo systemctl enable ttyd
MAKE SURE YOU DON'T RUN ANY COMMAND OTHER THAN login
AS ROOT, AND THAT YOUR ROOT ACCOUNT HAS NO PASSWORD. IF YOU CHOOSE TO RUN A DIFFERENT COMMAND, USE ANY NON-ROOT USER.