I'm using Apache2 to deploy a django app, I've set apache2 to a different user then apache. The problem is that when the server runs the user changes but the home directory environment variabile($HOME) remains /root.Why is that ?

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

I'm not an expert with the internals of Linux/Unix, but I think the system call that changes the effective user ID doesn't change any environment variables.

Environment variables would only get involved if a new process was being exec()'d or spawn()'d, i.e., when you start Apache.

You can write a small wrapper script to set $HOME to another value, and then start Apache. If you are using Debian, you can just modify /etc/init.d/apache2.

link|improve this answer
ended up adding HOME=cat /etc/passwd| grep $USER | cut -d ":" -f6 in /etc/init.d/httpd – John Retallack Sep 10 '10 at 13:37
feedback

Your Answer

 
or
required, but never shown

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