Plainnotes

Quotes and spaces in EnvironmentFile

2026-05-27 · 2 min readSystems

In /etc/default/app:

TOKEN=abc def

The service sees only abc. systemd's EnvironmentFile is not a shell: no command substitution, no export, and different quoting. Values with spaces need quotes around the whole value:

TOKEN="abc def"

Trailing comments are another trap — FOO=bar # comment may include the comment in the value depending on version. Put comments on their own line.

systemctl show app -p Environment prints exactly what systemd parsed, which beats guessing.