What's the preferred way to set environment variables for all users (on Ubuntu) such that the new variables are read whenever a new shell/terminal is started? Presently, we're using a file in /etc/profile.d/ but
- Changes aren't picked up when a user opens a new shell, and
- Only programs started through a login shell (e.g., we have to set terminals to run
/bin/bash -linstead of/bin/bash) actually read this file.
I guess one could demand a source line in all users' .bashrcs, but is there a way to keep everything in /etc?
/etc/profileshould be read by all login shells. If it is not setup to user/etc/profile.dyou won't get anywhere. There may be some requirements for file extension or permissions you need to tweak to get it to work. Getting/etc/profile.dworking is a good idea because it will make it easier to install future boxes withansibleor scripts.