Thursday, 19 December 2013

Re: Setting env. variables manually

Hello Gunnar,

just discussed on IRC, but for the records..

Gunnar Hjalmarsson [2013-12-13 5:59 +0100]:
> ~/.pam_environment
> /etc/environment

These are fine from my POV. They aren't shell scripts, so they are
"safer" in the sense that it's hard to get unintended side effects in
there.

> /etc/default/locale

This should be taken off the page. This is explicitly not the place to
set arbitrary environment variables.

> Personally I don't find any of them optimal. As regards
> ~/.pam_environment and /etc/default/locale, they are written to
> automatically when people set their languages and locales via the GUIs,
> so there is a risk that manual entries are accidentally overwritten.

That would be a bug in accounts-service & friends though. The PAM ones
have a rather simple line format, so it isn't hard to change existing
ones, and the code goes through some effort to not overwrite user
settings and keep the format nice.

> I tend to think that these files are preferred when you need to
> manipulate environment variables manually:
>
> ~/.profile - for user specific settings
> /etc/profile - for system wide settings

As Oliver said, /etc/profile.d/ is better. /etc/profile is maintained
by packages (although not as conffile) and it's already quite complex,
so it's easy for users to break it.

> I'm about to edit
> https://help.ubuntu.com/community/EnvironmentVariables, but before
> doing so, and since this is an area where established practice
> should be taken into consideration, I'd appreciate some input here
> before doing so.

Many thanks! Keeping docs up to date is indeed very important and
appreciated.

Martin

--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)

--
ubuntu-devel mailing list
[email protected]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel