Damien Miller
2025-Apr-19 04:41 UTC
Setting variable in /etc/environment has no effect for ssh session
On Thu, 17 Apr 2025, Yu, Mingli wrote:> Hi Expert, > > I'm using openssh 9.9p2 and have defined the below logic into /etc/pam.d/sshd. > session required pam_env.so > > But the environment variables defined in /etc/environment file are not > effective when login via ssh. Could you help to guide what's wrong here?I don't know why this isn't working for you, AFAIK it supported. Perhaps try turning on debugging logs from pam_env?
Darren Tucker
2025-Apr-19 22:21 UTC
Setting variable in /etc/environment has no effect for ssh session
On Sat, 19 Apr 2025 at 14:44, Damien Miller <djm at mindrot.org> wrote:> On Thu, 17 Apr 2025, Yu, Mingli wrote: > [...] > > I'm using openssh 9.9p2 and have defined the below logic into > /etc/pam.d/sshd. > > session required pam_env.so > > > > But the environment variables defined in /etc/environment file are not > > effective when login via ssh. Could you help to guide what's wrong here? > > I don't know why this isn't working for you, AFAIK it supported. > Perhaps try turning on debugging logs from pam_env? >Also check that you are actually using PAM in sshd ("UsePAM yes" in sshd_config, it defaults to no) and that if set, PAMServiceName refers to the config you expect (it defaults to "sshd"). -- Darren Tucker (dtucker at dtucker.net) GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
Reasonably Related Threads
- Setting variable in /etc/environment has no effect for ssh session
- Setting variable in /etc/environment has no effect for ssh session
- node crashing on 4 replicated-distributed cluster
- Setting variable in /etc/environment has no effect for ssh session
- [Bug 2246] New: PAM enhancements for OpenSSH server