[systemd-devel] [PATCH] man: Add a note about what environment variables are available by default.

Lennart Poettering lennart at poettering.net
Fri Jul 26 10:44:45 PDT 2013


On Fri, 26.07.13 19:00, Kay Sievers (kay at vrfy.org) wrote:

> 
> On Fri, Jul 26, 2013 at 12:42 PM, Kay Sievers <kay at vrfy.org> wrote:
> 
> >> cat /proc/$(pidof systemd-logind)/environ
> >> SYSFONT=latarcyrheb-sun16PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binbiosdevname=0LANG=de_DE.UTF-8divider=20KEYTABLE=de-latin1-nodeadkeysBOOT_IMAGE=/vmlinuz-3.9.10-100.fc17.x86_64
> >
> > What's currently done for environment variables and the rules how they
> > are passed-on is not obvious and quite a mess that needs fixing. I'll
> > look into it now ...
> 
> This made a couple of things less magic:
>   http://cgit.freedesktop.org/systemd/systemd/commit/?id=e21fea24ae2a7a04f6d5c9d2bbbaf5833d248952
> 
> For --system we export the following to the forked children:
>  - do not pass _any_ of the original env
>  - always statically set: PATH= to the usual suspects
>  - add the stuff from DefaultEnvironment=
>  - add the stuff from the kernel cmdline systemd.setenv=
> 
> For --user we inherit _everything_ from the parent and pass everything
> to the children.
> 
> In both cases:
>  - if we have a user UID, we add LOGNAME=, USER=, HOME=
>  - if we have a terminal connected we add TERM=

And one more thing: the environment returned by PAM is also added. 

Oh, and for socket actviated stuff there might be LISTEN_FDS and
LISTEN_PID.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list