This is my /etc/environment:
HELLO="hello"
Now I check that the environment is being set when connecting via ssh:
ssh foobar@my_host env
And this is the output:
SHELL=/bin/bash
SSH_CLIENT=foobar 46460 56723
USER=foobar
MAIL=/var/mail/foobar
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PWD=/home/foobar
LANG=en_US.UTF-8
SHLVL=1
HOME=/home/foobar
LOGNAME=foobar
SSH_CONNECTION=foobar 46460 foobar 56723
_=/usr/bin/env
So: why is HELLO not being set? Is /etc/environment being parsed at all in Ubuntu? What is the recommended way to set system wide environment variables in Ubuntu?
And as bonus, it would be great if those system wide environment variables work when doing:
- ssh (non-interactive commands)
- ssh (interactive commands)
- cron jobs
- interactive login shells
- and what-not
I mean, when I am thinking about system-wide environment variables, I really mean it!
I do not need a different method for each possible way I have to get into my machine: I just need one method, which works for all users, all commands, all login mechanisms: what could be simply described as a "system-wide setting".
Sorry for the ironic mode, but I have just been losing (again) some time with this issue.