You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Has anyone gotten Linux-PAM to work on Microsoft's WSL2 (especially pam_env)? #481
I'm especially interested in the pam_env module. Trying it out in a bare bones Debian distribution on WSL2 Linux-PAM seems to be setup as usual. For example in /etc/pam.d/login I am seeing this block which enables /etc/environment.
# This module parses environment configuration file(s)
# and also allows you to use an extended config
# file /etc/security/pam_env.conf.
#
# parsing /etc/environment needs "readenv=1"
session required pam_env.so readenv=1
# locale variables are also kept into /etc/default/locale in etch
# reading this file *in addition to /etc/environment* does not hurt
session required pam_env.so readenv=1 envfile=/etc/default/locale
Yet the variables set in /etc/environment never show up in my environment. The WSL2 GitHub repo has nothing on this topic except few people wondering why /etc/environment is not parsed.
I think I got it to work partially on a throwaway instance. I simply followed the "Linux from Scratch" guide. I only followed the part where Linux-PAM is installed and skipped everything regarding configuring it as the config is already there.
Now /etc/environment is parsed once I perform a sudo login. But terminating the WSL distribution and logging in the default way does not lead to the file getting parsed. So it seems like Microsoft uses another way of handling login.
Activity
trallnag commentedon Jul 31, 2022
I think I got it to work partially on a throwaway instance. I simply followed the "Linux from Scratch" guide. I only followed the part where Linux-PAM is installed and skipped everything regarding configuring it as the config is already there.
https://www.linuxfromscratch.org/blfs/view/svn/postlfs/linux-pam.html
Now
/etc/environmentis parsed once I perform asudo login. But terminating the WSL distribution and logging in the default way does not lead to the file getting parsed. So it seems like Microsoft uses another way of handling login.trallnag commentedon Jul 31, 2022
Nevermind, Linux-PAM does not need to be installed. It's already there by default.
sudo loginmakes all the difference.Adding
session required pam_env.so readenv=1tocommon-sessiondoes not help either.