More guides

Linux servers

Headless sign-in#

Use this on servers and SSH hosts without an unlocked desktop keyring. You need:

  • a regular Unix account and an interactive terminal (for SSH, connect with ssh -t user@host);
  • a trusted /usr/bin/systemd-creds from systemd 256–259 (older and unreviewed newer versions are rejected);
  • a working user credential broker.
Terminal
line login --headless
line auth status --check --json

The first command uses QR login. For email and password, use line login --headless --email you@example.com instead. Wait for Session saved securely before checking storage. --headless only chooses the storage; signing in still needs the terminal and your phone.

Before contacting LINE, the CLI asks you to accept Host key; no TPM, and --force doesn't skip this. The key protects the session from other unprivileged users, but not from root, malware running as your account, or a full disk copy, and there is no TPM protection. Cancelling before the session is saved leaves no new local session.

After setup, run ordinary commands without --headless. Signing in again keeps the chosen storage; login --headless never converts or overwrites an existing native session. Use the same Unix account and config folder for commands, SSH, cron, and services.

Debian 13 (systemd 257) and Ubuntu 26.04 (systemd 259) were validated on disposable VMs. Other accepted versions still need a successful check on your machine. UniPi and physical TPM behavior haven't been verified.

Move an existing session#

To move a working native Linux session to headless storage:

Terminal
line auth migrate --storage=headless

Migration needs a terminal and the same explicit host-only consent. Stop watchers, automation, and older CLI versions first. It keeps your tokens, encryption keys, request sequence, and watch checkpoint, without contacting LINE or asking for your password.

If migration stops partway, run the same command again. Don't delete migration.pending or replace session.enc by hand. line auth status reports migration_pending until cleanup finishes. The headless storage internals explain how recovery works.

Run a watcher service#

Sign in interactively as a dedicated unprivileged account. After a reboot, run line auth status --check as the same user and with the same environment the service will use, and keep HOME and XDG_CONFIG_HOME consistent. The CLI doesn't create services or cron jobs for you.

For a systemd user service, save this as ~/.config/systemd/user/line-watch.service for that account. Change ExecStart if line is installed elsewhere. %h is the account's home folder. Don't add User= to a user service.

systemd
[Unit]
Description=LINE event watcher
StartLimitIntervalSec=300
StartLimitBurst=5

[Service]
Environment=HOME=%h
Environment=XDG_CONFIG_HOME=%h/.config
UMask=0077
NoNewPrivileges=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
LockPersonality=true
MemoryDenyWriteExecute=true
ExecStart=%h/.local/bin/line watch
Restart=on-failure
RestartSec=15s
RestartPreventExitStatus=65 69 74 78

[Install]
WantedBy=default.target

These settings worked on the Debian 13, systemd 257.13, ARM64 machine reported in issue #3. Check them on your own machine before enabling the service. AF_UNIX lets the credential broker work; AF_INET and AF_INET6 allow LINE connections and DNS.

Terminal
systemctl --user daemon-reload
systemctl --user start line-watch.service
systemctl --user status line-watch.service
# Enable it after you confirm that storage and the watcher work:
systemctl --user enable line-watch.service

To start a user service without an interactive login, an administrator may need to enable lingering. For a system service instead, add User=linebot, use explicit /home/linebot paths for both environment variables, and set WantedBy=multi-user.target.

Watch output contains private messages. Restrict access to its journal and output files. Cron jobs should use the same account and paths, with umask 077.

Diagnose a service#

These systemd settings failed in the issue #3 user service:

SettingWhat happened
PrivateTmp=trueHeadless helper unavailable; exit 69.
ProtectSystem=strictHeadless helper unavailable; exit 69.
ProtectHome=read-onlyNonzero exit, including a file write failure.

Leave these and PrivateUsers= out of your starting unit. Adding ReadWritePaths=%h/.config/line-cli alone didn't fix the failures. These come from one user-service setup, not rules for every system service.

A user namespace created by systemd can hide the host's root user from a per-user service: with PrivateUsers=true, the root-owned helper may appear to have an unmapped owner (systemd 257 documentation). The CLI rejects a helper whose ownership and permissions it can't verify. Read-only mounts can also block locks, path records, refreshed tokens, request sequences, and watch checkpoints. Both $XDG_CONFIG_HOME/line-cli and $HOME/.config/line-cli need write access, even if they are different folders.

Run line auth status --check --json as the service user, both interactively and inside a temporary unit with the same environment and hardening. Change the executable path if needed:

Terminal
systemd-run --user --wait --collect \
  --property=Environment=HOME="$HOME" \
  --property=Environment=XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" \
  --property=UMask=0077 \
  --property=NoNewPrivileges=true \
  --property='RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6' \
  --property=LockPersonality=true \
  --property=MemoryDenyWriteExecute=true \
  "$HOME/.local/bin/line" auth status --check --json

This check is local and doesn't contact LINE. Change one sandbox setting at a time:

  • headless_helper_untrusted (exit 69): the helper or a parent folder failed an ownership or permission check. Look at the sandbox settings the error names, and also at the real install permissions.
  • headless_unavailable: finding the helper, checking its version, or running it as root failed. The error names the step.
  • storage_unavailable: the credential broker or unsealing may have failed. The helper's stderr isn't shown.

Get the service environment working again before you consider signing in again or deleting anything. If the service stopped, fix storage, run systemctl --user reset-failed line-watch.service, and start it again. Exit 69 stops automatic watcher restarts. That restart policy never applies to sends or other remote changes.

Session files and upgrades#

On Linux, the encrypted session file and both process locks live in $XDG_CONFIG_HOME/line-cli, normally ~/.config/line-cli. Changing XDG_CACHE_HOME doesn't move the locks. Keep that folder private (0700) and its files private (0600). The CLI rejects unsafe ownership, wrong file types, symlinks at the folder or its files, and hard-linked files. It doesn't change permissions on existing parent folders.

Login checks storage before asking you for anything, then checks the session and storage again before contacting LINE. It writes to a separate temporary credential item or file, so the active session stays in place. If storage is unreadable or damaged, restore access first, or log out explicitly to remove the local session. If another login or logout changes the session while you're typing, start the command again.

Linux also records the session paths it has seen in native-paths.json under $HOME/.config/line-cli. If older releases used other XDG_CONFIG_HOME locations, run line auth status once with each old location before migrating or logging out, so the CLI doesn't delete a key another folder still needs. Don't delete the path record or the lock files as a shortcut.

Stop old commands and watchers before upgrading to this lock layout; running old and new binaries together isn't supported. Keep the lock files after logout. Several config folders aren't a supported way to use several accounts, because native Linux storage uses one key per Secret Service keyring.

If you see an uncertain-durability error, the file may already have changed. Repeat the same local operation; don't restore an older copy. Logout keeps a private recovery record and can be run again to finish an interrupted cleanup.

Storage exit codes#

CodeMeaning
65Invalid format, missing key, failed authentication, or protection mismatch.
69Storage or helper unavailable or timed out.
74Uncertain durability or failed probe cleanup.
75Local contention, storage changed during login, or helper cancellation.
78Configuration, consent, migration, repair, or interactive-check requirement.

Signals take precedence: SIGINT exits 130 and SIGTERM exits 143. Other CLI and network errors exit 1. auth status --json can still write its status object when storage is unavailable, then exit with the matching code.

Last updated Dec 1, 2026Edit this page