5

I have a weird issue with my Debian Sid system. I want to set a global environment variable in /etc/environment, which is supposed to be read by the pam_env module. Unfortunately, after having relogin in the system, the variable is not set.

On another Arch Linux box, the same variable set in etc/environment is defined as expected. Just for testing, I tried to setup a local env variable in .pam_environment and, again, on Debian it's not being defined while on Arch it is.

I'm using GDM on Debian and SDDM on Arch as login managers. What am I missing? Which (PAM or GDM) configuration files should I look at?

EDIT: output of grep pam_env /etc/pam.d/*

$ grep pam_env /etc/pam.d/*
/etc/pam.d/atd:auth     required        pam_env.so
/etc/pam.d/cron:# Read environment variables from pam_env's default files, /etc/environment
/etc/pam.d/cron:# and /etc/security/pam_env.conf.
/etc/pam.d/cron:session       required   pam_env.so
/etc/pam.d/cron:session       required   pam_env.so envfile=/etc/default/locale
/etc/pam.d/gdm-autologin:session required        pam_env.so readenv=1
/etc/pam.d/gdm-autologin:session required        pam_env.so readenv=1 envfile=/etc/default/locale
/etc/pam.d/gdm-launch-environment:session required        pam_env.so readenv=1
/etc/pam.d/gdm-launch-environment:session required        pam_env.so readenv=1 envfile=/etc/default/locale
/etc/pam.d/gdm-password:session required        pam_env.so readenv=1
/etc/pam.d/gdm-password:session required        pam_env.so readenv=1 envfile=/etc/default/locale
/etc/pam.d/login:# file /etc/security/pam_env.conf.
/etc/pam.d/login:session       required   pam_env.so readenv=1
/etc/pam.d/login:session       required   pam_env.so readenv=1 envfile=/etc/default/locale
/etc/pam.d/polkit-1:session       required   pam_env.so readenv=1 user_readenv=0
/etc/pam.d/polkit-1:session       required   pam_env.so readenv=1 envfile=/etc/default/locale user_readenv=0
/etc/pam.d/su:# file /etc/security/pam_env.conf.
/etc/pam.d/su:session       required   pam_env.so readenv=1
/etc/pam.d/su:session       required   pam_env.so readenv=1 envfile=/etc/default/locale
6
  • superuser.com/a/664236/257378
    – goldilocks
    Commented Jan 5, 2015 at 17:52
  • @goldilocks See the updated answer for the output of grep -l pam_env /etc/pam.d/*
    – eang
    Commented Jan 5, 2015 at 17:53
  • Have a look at man pam_env and man pam.d. I don't know the answer here, but that's where I'd start investigating -- I notice not everything in pam.d references the pam_env modules.
    – goldilocks
    Commented Jan 5, 2015 at 18:02
  • Remove the -l from your grep command, the pam_env module needs readenv=1 to process the /etc/environment file. Your grep output now doesn't tell whether that's enabled or not.
    – wurtel
    Commented Jan 6, 2015 at 10:18
  • 2
    Does it work if you use ssh to login to your system? Otherwise it all looks fine so I have no idea why it's not working for you. No messages appearing in some syslog file when you login that could indicate an error somewhere?
    – wurtel
    Commented Jan 7, 2015 at 11:29

1 Answer 1

0

For posterity: if, on Debian, you add

session required        pam_env.so user_readenv=1

to /etc/pam.d/gdm-password then PAM will indeed apply your env var settings in ~/.pam_environment when you do a password login using GDM. If you log in using something else then look for the corresponding file under /etc/pam.d.

1
  • That to common session works for a gdm3 gnome login. It doesnt (there or gdb-password) on debian bullseye logging into default xsession (calling i3) via gdm. What a right royal mess. The whole startup thing too. For those that deny it, just Google the issues..
    – RichieHH
    Commented Dec 3, 2020 at 15:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .