Skip to main content
← Back to list
01Issue
FeatureShippedSwamp CLITeam
Assigneesstack72

Relationships

#988 Support user systemd units for 'swamp serve daemon enable'

Opened by evrardjp · 7/6/2026· Shipped 7/6/2026

Problem

Running swamp serve daemon enable as a normal user attempts to write a system unit under /etc/systemd/system and fails with a raw permission error:

$ swamp serve daemon enable
14:49:07.570   fatal   error                { PermissionDenied: Permission denied (os error 13): writefile '/etc/systemd/system/.02708f58-9132-4a24-a821-c6dc9e330a63.tmp'
                                                at async writeFile (ext:deno_fs/30_fs.js:916:7)
                                                at async atomicWriteTextFile (file:///tmp/deno-compile-swamp/src/infrastructure/persistence/atomic_write.ts:41:5)
                                                at async SystemdServiceScheduler.enable (file:///tmp/deno-compile-swamp/src/infrastructure/daemon/systemd_service_scheduler.ts:126:5)
                                                at async Command.<anonymous> (file:///tmp/deno-compile-swamp/src/cli/commands/serve.ts:343:5)
                                                at async Command.execute (https://jsr.io/@cliffy/command/1.0.1/command.ts:2307:7)
                                                at async Command.parseCommand (https://jsr.io/@cliffy/command/1.0.1/command.ts:2140:14)
                                                at async file:///tmp/deno-compile-swamp/src/cli/mod.ts:1371:7
                                                at async runCli (file:///tmp/deno-compile-swamp/src/cli/mod.ts:1363:5)
                                                at async file:///tmp/deno-compile-swamp/main.ts:42:5
                                              code: "EACCES" }

The command appears to expect root privileges but does not say so up front, and there is no obvious way to install the daemon as a per-user systemd unit.

Proposed solution

Add a --user option to swamp serve daemon enable that writes a user service unit (for example under the user systemd location) and enables it with systemctl --user semantics.

Also improve the default/root path behavior so that, when --user is not supplied and the current user cannot write /etc/systemd/system, the CLI reports an actionable error such as: run with sudo/root privileges, or use --user for a user service.

Alternatives

  • Document that swamp serve daemon enable must be run as root for system units.
  • Automatically fall back to a user unit when root privileges are unavailable, though an explicit --user flag is probably clearer.

Environment

Observed on a Linux host using systemd, as user, with swamp serve daemon enable.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 3 MOREFINDINGS+ 4 MOREPR_MERGED+ 1 MORECONTRIBUTOR_NOTIFIED

Shipped

7/6/2026, 4:36:15 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack727/6/2026, 3:25:47 PM
Editable. Press Enter to edit.

stack72 commented 7/6/2026, 4:36:26 PM

Thanks @evrardjp for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.