New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make environment variables from */environment.d/*.conf visible in login sessions #7641
Comments
|
well, very simply, i don't really see a way to implement that. there's no hook that would allow us to insert code right after the various programs that permit logins dropped privs, but before they invoke the user's $SHELL, or gnome-session or whatever else they need. There are specific hooks for various shells, but as you point out that doesn't really solve anything. hence, i doubt there's anything we can do here... |
|
Hm. I kind of expected an answer like that. I just was not sure whether i understood the problem correctly, hence filed this report. |
|
Just a random thought: Wouldn't it be possible to implement the injection of the environment via some pam module, if that module would not parse the environment configuration files, but instead would drop priviledges like pam_env does and would talk to the systemd user manager, querying the user environment and setting it in the started session? |
|
system environment variables can be sensitive and should not be passed to the user logins. it can also be done with a simple script in bashrc if this what the user whats: |
|
I did not talk about system environment variables. I have suggested to pull in the environment variables stored in the systemd USER manager process, which the user has access to anyways. So there would not be any environment variables of the main systemd process passed to the user logins. |
|
What if there're no intermediary wrappers and the user's session is managed directly by "systemd --user"? |
|
just ran into this issue aswell, even if no solution is possibly are there better workarounds than multiple per shell configuration files (assume I have bash and zsh)? For For openssh I would not know. |
Another reason against this: If I'm logged in via a graphical session and now connect over SSH, I pull in things like Edit: Such a workaround has actually already been documented in the ArchLinux wiki: https://wiki.archlinux.org/index.php/Talk:Environment_variables#Consistently_setting_variables_across_systemd_units_&_regular_sessions |
A generator already do the same: export $(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator) |
Oh that's nice and I think a relatively workable solution that should cover the mentioned use-case, if I'm not missing something? |
|
Here's a more robust & POSIX-ly portable form of @abouvier's snippet: set -a
. /dev/fd/0 <<EOF
$(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator)
EOF
set +a |
|
With the pending |
|
Arch Linux has just deprecated reading from There is some discussion of adding a source-able environment file here: #20914 |
Submission type
systemd version the issue has been seen with
Used distribution
Remarks
In case of bug report: Expected behaviour you didn't see
The current situation is somewhat disappointing, as a unique reliable way of configuring environment variables does not exist.
The text was updated successfully, but these errors were encountered: