On Sun, Sep 24, 2023 at 09:27:36AM -0500, Tom Browder wrote: > Every time I set up a new host, I have to jump through the hoops trying to > get the same PATH for ordinary users as well as root, regardless of how > they log in. Reading the man pages doesn't help my old brain with all the > caveats. > > Can anyone offer a foolproof, programmatic solution to my conumdrum?
Nope. There is no simple, foolproof, login-method-agnostic solution. The only login-method-agnostic tool available to you is pam_env and this triggers too early. You can set a PATH that way, but then the login shell, or the desktop environment, takes over and overwrites the PATH. systemd offers nothing which addresses this either. It only has things that LOOK like they might work, but then they turn out to do nothing (they are not used by logins). That's a dead end. So, at the end of the day, you're right back where you started. All environment customizations are unique to the login method and the shell and the desktop environment of the individual system and user.