LinuxCommandLibrary

systemctl-set-environment

Set service manager environment variables

TLDR

Set environment variable

$ systemctl set-environment [VAR=value]
copy
Set multiple variables
$ systemctl set-environment [VAR1=val1 VAR2=val2 ...]
copy
Set for user manager
$ systemctl set-environment [VAR=value] --user
copy

SYNOPSIS

systemctl set-environment VARIABLE=VALUE...

DESCRIPTION

systemctl set-environment adds or updates environment variables in the systemd service manager's environment. These variables are passed to all services started after the change.
This is useful for injecting configuration into services without modifying their unit files.

PARAMETERS

--user

Set in user service manager environment
--system
Set in system manager environment (default)

CAVEATS

Only affects services started after the change. Changes are temporary and lost on reboot. Already running services are not affected. Use `import-environment` to import from the shell.

HISTORY

The set-environment subcommand enables dynamic environment configuration for services, complementing unit file Environment= directives.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community