Ubuntu – Setting global environment variable for everyone

environment-variables

If I set a variable in /etc/environment, it only seems to apply to administrators while in sudo su.

How can I get the variables to apply to everyone? Especially when they are in terminal? Do the settings in /etc/enviroment not apply to bash?

Best Answer

The /etc/environment update will only work on the next session, it's not automatically reloaded.

Which means you cannot change it for sessions that have already started for other users.

If you want to "reload" whatever is in the /etc/environment you need the following command:

source /etc/environment

But again it will only work for your own current session, other users won't be affected until they start a new session or run the above command in their own session.

Related Question