1

I want to append to the system-wide $PATH. How can I do this in MX Linux (MX-22.2.1_x64 ahs)?

To be totally clear:

  1. I want to append to the existing $PATH, not set an entirely new one. (So editing /etc/environment is out of the question.)
  2. I want to modify the system-wide $PATH, not a shell-specific $PATH (such as .bashrc, .bash_profile, etc.), or a user-specific $PATH.

Is this possible?

I found /etc/environment.d, which seems perfect for my needs, but it seems to be ignored by default. Is there a way to enable it?


Edit: Here's the output of grep -iR "pam_env" /etc/pam.d:

/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
/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/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/lightdm:# Load environment from /etc/environment and ~/.pam_environment
/etc/pam.d/lightdm:session      required pam_env.so readenv=1
/etc/pam.d/lightdm: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/lightdm-autologin:# Load environment from /etc/environment and ~/.pam_environment
/etc/pam.d/lightdm-autologin:session      required pam_env.so readenv=1
/etc/pam.d/lightdm-autologin:session      required pam_env.so readenv=1 envfile=/etc/default/locale
/etc/pam.d/lightdm-greeter:# Load environment from /etc/environment and ~/.pam_environment
/etc/pam.d/lightdm-greeter:session      required pam_env.so readenv=1
/etc/pam.d/lightdm-greeter:session      required pam_env.so readenv=1 envfile=/etc/default/locale
midrare
  • 153
  • 1
  • 1
  • 5
  • Does the `/etc/profile.d/` directory exist in your system? – Edgar Magallon Oct 17 '22 at 03:58
  • @EdgarMagallon Yes, but it's ignored. – midrare Oct 17 '22 at 04:00
  • I guess your `/etc/profile` file is not sourcing the files inside `/etc/profile.d/` directory. But that's weird, usually all Linux distros (at least what I've used) source every file in `/etc/profile.d/` – Edgar Magallon Oct 17 '22 at 04:04
  • Have you tried to logout/restart the system? Can you add to your question the output of `grep -iR "pam_env" /etc/pam.d/` – Edgar Magallon Oct 17 '22 at 04:08
  • @EdgarMagallon I've added the `grep` output above. I restarted with every change. `/etc/profile` *is* sourcing `/etc/profile.d`, but the thing is that `/etc/profile` is ignored altogether (adding `export PATH=...` directly in `/etc/profile` does nothing). I think `/etc/profile` and `/etc/profile.d` are bash-specific though. – midrare Oct 17 '22 at 06:28
  • @EdgarMagallon Also, it might be relevant that MX Linux uses sysvinit instead of systemd. – midrare Oct 17 '22 at 06:29
  • It seems `pam.d` files are configured correctly. What is the user default shell that you are using? `bash`, `zsh` or any other? – Edgar Magallon Oct 17 '22 at 07:11
  • @EdgarMagallon I'm running the default shell, `GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)`. It's a fresh install, so I can't imagine anything being misconfigured. – midrare Oct 17 '22 at 19:55
  • I really have no idea about what is happening. When `bash` acts as a `login shell` should read the file `/etc/profile`. You could ask this question in [MXLinux reddit](https://www.reddit.com/r/MXLinux/) – Edgar Magallon Oct 17 '22 at 21:55

0 Answers0