Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question

1 Answer 1

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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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