2

I want to set the environmental variable GNUPGHOME=/path/to/home for the apache user www-data. I tried setting GNUPGHOME inside /etc/profile with

if [ "`id -u`" -eq 33 ]; then
    export GNUPGHOME="/path/to/home"
fi

Here 33 is the user id of the user www-data. However, even after a fresh restart when I su www-data and run echo $GNUPGHOME I see that the variable is not set.

How can I make it so the user www-data's GNUPGHOME variable is set?

5

There is a file called/etc/apache2/envvars to which I added export GNUPGHOME="/path/to/home" which does what I wanted.

1
0

Are you certain you want to set the environment variable for the actual Apache user, and not for use within Apache itself? Environment variables in Apache are usually implemented via a set of modules, with mod_env and friends - http://httpd.apache.org/docs/2.2/env.html

What exactly is your use case? Is there a script/cron that you need to run as the www-data user perhaps?

1
  • The use case is that I want to do some server side encryption using gpg, but don't want to store my secret keys in /var/www/.gnupg, so I want to change GNUPGHOME to a more suitable location for the apache user. – nullUser Jul 8 '14 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.