Skip to content

Run as a systemd Service

Use a user-level systemd unit to run term-serve continuously.

~/.config/term-serve/env:

PORT=31337
AUTH_TOKEN=your-secure-auth-token-here

Restrict permissions:

Terminal window
chmod 600 ~/.config/term-serve/env

~/.config/systemd/user/term-serve.service:

[Unit]
Description=term-serve (user)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=%h/.local/bin/term-serve --host=0.0.0.0 --auth-token=${AUTH_TOKEN} --cwd=%h
Restart=on-failure
RestartSec=1
EnvironmentFile=%h/.config/term-serve/env
[Install]
WantedBy=default.target
Terminal window
systemctl --user daemon-reload
systemctl --user enable --now term-serve.service
Terminal window
journalctl --user -u term-serve.service -f
  • If you bind to non-local interfaces, always set an explicit token.
  • Prefer TLS and a perimeter (VPN / tunnel / access-controlled proxy).