Bug 15767 - openssh session don't use /etc/environment nor /etc/security/pam_env.conf
Summary: openssh session don't use /etc/environment nor /etc/security/pam_env.conf
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: connectivity (show other bugs)
Version: 5.0.7
Hardware: x86 x86_64
: Medium+ normal
Target Milestone: 5.3 M1
Assignee: Mingli Yu
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2025-02-20 21:26 UTC by Trent Piepho
Modified: 2026-02-03 14:23 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trent Piepho 2025-02-20 21:26:09 UTC
It should be possible to add environment variables to all sessions via /etc/environment or in /etc/security/pam_env.conf

This works for console logins, but not with openssh logins.

The problem appears to be that nothing in /etc/pam.d/sshd will load pam_env.so.

Perhaps the libpam package should add this to /etc/pam.d/common-session?  This file is referenced by the sshd pam configuration.  E.g., add this:
>session required        pam_env.so readenv=1
Comment 1 Randy MacLeod 2025-02-27 15:33:37 UTC
Interesting suggestion. Debian does this.

Can you send a patch to the list?
https://docs.yoctoproject.org/contributor-guide/index.html
Comment 2 Randy MacLeod 2025-03-21 20:12:11 UTC
Trent do you have time for this?
I've CCed Mingli who may be able to work on it if you can't or if you don't reply by March 25, 2025.
Comment 3 Randy MacLeod 2025-04-10 15:02:36 UTC
Mingli, Can you work on this and maybe email Trent if needed.
He didn't reply to the YP BZ NEEDINFO emails.
Comment 5 Clayton Casciato 2026-01-28 17:43:36 UTC
[meta-selinux][PATCH 0/1] openssh: Add pam_env support
https://lists.yoctoproject.org/g/yocto-patches/topic/meta_selinux_patch_0_1/117511888

[meta-selinux][PATCH 1/1] openssh: Add pam_env support
https://lists.yoctoproject.org/g/yocto-patches/topic/meta_selinux_patch_1_1/117511975