Single-user install, in detail
You don't need this page to install. It explains what ./install.sh does in the default case.
This is the default. The app and the tunnel run as your Linux user, as systemd user services, and start at boot. Only Cloudflare accounts mapped to your username can open a terminal.
With the installer#
./install.sh --host term.example.com --identities you@example.com:$USER
Step by step#
The installer only runs these scripts in order. You can run them yourself:
# 1. Who may log in
mkdir -p -m 700 ~/.config/cloudflare-tmux
install -m 600 .env.example ~/.config/cloudflare-tmux/env
sed -i "s/^IDENTITIES=.*/IDENTITIES=you@example.com:$USER/" ~/.config/cloudflare-tmux/env
# 2. Cloudflare: tunnel, login method, Access application, DNS record
scripts/cloudflare.sh term.example.com
# 3. Services
scripts/setup.sh
scripts/cloudflare.sh asks for an API token and writes CF_TEAM_DOMAIN and
CF_ACCESS_AUD to the config file.
scripts/setup.sh:
- runs
npm ci --omit=dev, which buildsnode-pty; - writes two units to
~/.config/systemd/user/:cloudflare-tmux.servicerunsnode server.jsfrom this checkout, andcloudflare-tmux-cloudflared.serviceruns the tunnel with the saved token; - enables and restarts both;
- turns on lingering, so the services run while you're logged out and start at boot.
Note
If enabling linger fails, run sudo loginctl enable-linger $USER once. Without it, the services stop when
you log out and don't start at boot.
Where things live#
| Path | What |
|---|---|
~/.config/cloudflare-tmux/env |
app config, mode 600 |
~/.cloudflared/cloudflare-tmux.token |
tunnel run token, mode 600 |
~/.config/systemd/user/cloudflare-tmux*.service |
the two units |
The units run the code from this checkout. After git pull, run scripts/setup.sh again. Your tmux
sessions survive the restart: the unit uses KillMode=process, so stopping the web server never stops the
tmux server it started.