34
submitted 3 days ago by cm0002@toast.ooo to c/linux@programming.dev
top 6 comments
sorted by: hot top controversial new old
[-] exu@feditown.com 9 points 2 days ago

At the risk of being serious, there's really no good way to set user environment variables. (It's been a while since I last checked, so I might be wrong)

PAM used to have an equivalent to their /etc/environment for users, but that was deprecated or maybe removed last I checked.

Systemd user environment variables don't apply in a shell context

.bashrc only works if you use bash as login shell and I'm not sure if it applies everywhere. Sure, I can set stuff in the shell I use, but it feels weird to modify my shell in order to change global environment variables.

[-] LiveLM@lemmy.zip 4 points 2 days ago

Yeah it's such a mess. Last I tried I had to set my variable in like 3 different places and it still didn't apply everywhere I expected it to.

[-] eleijeep@piefed.social 4 points 2 days ago* (last edited 2 days ago)

It sounds like you've looked into this before, so I'll ask you: what is the use-case for per-user environment variables that can't be achieved trivially through ~/.bashrc or /etc/profile ?

It sounds to me like the problem they want to solve is that there is some piece of information which needs to be present in the environment for every process that a user runs regardless of the context it was executed from (eg. DBUS_SESSION_BUS_ADDRESS)?

In which case it would surely be served better by being contained in a config file in a standard location where it can be read by every process that needs that info instead of the executing process having to know the information and pass it in the environment, for every possible caller and calling context.

[-] exu@feditown.com 1 points 1 day ago

/etc/profile also needs root to edit. I agree that there should be a config file in a standard location, my issue is that using $(your local shell config) is barely a standard.
For this purpose PAM's /etc/environment works great in the global context, but there's no PAM equivalent for each user.
Systemd has global and per user environment stuff, but last I checked this only worked for systemd services

[-] lambalicious@lemmy.sdf.org 14 points 3 days ago

Fedora rejects something from systemd

date: April 1

source: Phoronix

Yeah no, good try tho. Had me hopeful for 6 seconds.

this post was submitted on 01 Apr 2026
34 points (92.5% liked)

Linux

13124 readers
478 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS