On most systems, you can set environment variables in the file ~/.pam_environment
and they will apply to all login methods, even those that don't start a login shell and so don't load .profile
. This file is read by the PAM module pam_env
, i.e. the PAM configuration file /etc/pam.conf
or /etc/pam.d/XXX
for the service that logs the user in should mention the pam_env
module.
The syntax of ~/.pam_environment
is one VARIABLE=VALUE
per line. You can't have any shell syntax such as quoting or references to other variables. In your case you would put a line like
TMPDIR=/somewhere/tmp-for-builds