Skip to content

Has anyone gotten Linux-PAM to work on Microsoft's WSL2 (especially pam_env)? #481

Open

Description

@trallnag

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.

Activity

  1. trallnag commented on Jul 31, 2022

    @trallnag
    Author

    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

    image

    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.

  2. trallnag commented on Jul 31, 2022

    @trallnag
    Author

    Nevermind, Linux-PAM does not need to be installed. It's already there by default. sudo login makes all the difference.


    Adding session required pam_env.so readenv=1 to common-session does not help either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions