From 3ea2b1137b6a929895510d88b89e2091bc34cb21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 28 Feb 2020 10:56:38 +0100 Subject: man: add explanation where environment.d are inherited This is far from trivial, I guess. Fixes #14714. --- man/environment.d.xml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'man/environment.d.xml') diff --git a/man/environment.d.xml b/man/environment.d.xml index 69c156aacb..17c2c505ed 100644 --- a/man/environment.d.xml +++ b/man/environment.d.xml @@ -36,11 +36,11 @@ Description - The environment.d directories contain a list of "global" environment - variable assignments for the user environment. + The environment.d directories contain a list of environment variable + assignments for services started by the systemd user instance. systemd-environment-d-generator8 - parses them and updates the environment exported by the systemd user instance to the services it - starts. + parses them and updates the environment exported by the systemd user instance. See below for an + discussion of which processes inherit those variables. It is recommended to use numerical prefixes for file names to simplify ordering. @@ -89,6 +89,33 @@ + + Applicability + + Environment variables exported by the user manager (systemd --user instance + started in the user@uid.service system service) apply to + any services started by that manager. In particular, this may include services which run user shells. For + example in the Gnome environment, the graphical terminal emulator runs as the + gnome-terminal-server.service user unit, which in turn runs the user shell, so that + shell will inherit environment variables exported by the user manager. For other instances of the shell, + not launched by the user manager, the environment they inherit is defined by the program that starts + them. Hint: in general, + systemd.service5 + units contain programs launched by systemd, and + systemd.scope5 + units contain programs launched by something else. + + Specifically, for ssh logins, the + sshd8 + service builds an environment that is a combination of variables forwarded from the remote system and + defined by sshd, see the discussion in + ssh1. + A graphical display session will have an analogous mechanism to define the environment. Note that some + managers query the systemd user instance for the exported environment and inject this configuration into + programs they start, using systemctl show-environment or the underlying D-Bus call. + + + See Also -- cgit v1.2.1