Run untrusted code in an isolated transient systemd unit with systemd-run
domain: freedesktop.org · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗
Documented steps
Launch a transient service with hardening via --property=, e.g.: systemd-run --unit=untrusted --property=NoNewPrivileges=yes --property=PrivateTmp=yes --property=ProtectSystem=strict --property=CapabilityBoundingSet= -- /path/to/untrusted
Use --scope to run synchronously as a transient .scope unit that inherits the caller's environment and returns when the command finishes
Use --wait to make a transient service synchronous (block until the unit exits)
For interactivity add --pty (implies synchronous wait) or --shell which expands to --pty --same-dir --wait --collect --service-type=exec $SHELL
Copy output to the journal with -v / --output to inspect results afterward
Known gotchas
The default service type is simple, so a non-executable command still reports success - use --property=Type=exec so the unit fails if execve fails
The service manager expands $ variables in the command; literal dollar signs must be escaped as $$
--scope runs in the caller's context (synchronous); a transient service runs detached under the service manager
Pass systemd.exec hardening per unit with --property=
Give your agent this knowledge — and 18,000+ more routes
One MCP install gives any agent live access to the full route map across 6,000+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?