[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Systemd user environment variables not picked up for me


29 juin 2020 à 17:52 de wooledg@eeg.ccf.org:

> The holy grail, for me, would have been a way to specify environment
> variables that are applied to all user logins, whether by console login,
> or ssh, or Display Manager, independent of the user's login shell.
> And those variables must include a way to reference existing shell
> variables like $HOME, so that one can (for example) set MAIL=$HOME/Maildir/
> somewhere and have it actually *work*.
> pam_env gives us the /etc/environment file which is potentially useful,
> as it does in fact support many of the features I was looking for.  But
> you cannot use reference to other shell variables there.  If you put
> MAIL=$HOME/Maildir/ in /etc/environment and login, you will have the
> literal characters $ H O M E in the resulting variable.
> Even more subtly, it turns out that at the time this particular PAM
> module runs, the HOME variable isn't even *set* yet.  So, even if you
> used some module that can use existing variables, it wouldn't help
> for this.  (Yes, I went down that pathway too.)
It seems you can reconstruct those "early" variables like the following:

Or use @{HOME} directly since PAM 1.2.0.

Source: https://unix.stackexchange.com/questions/258246/why-does-pam-environment-not-include-home-in-my-new-path

Best regards,

Reply to: