Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Debian Lenny server, and I would like the www-data user to have /usr/local/zend/bin in its PATH, so it can execute a script in cron as www-data.

How do I add /usr/local/zend/bin to PATH, so www-data can execuate files in /usr/local/zend/bin ?

share|improve this question
up vote 22 down vote accepted

The first place where PATH is set is /etc/login.defs. There's a setting for root and a setting for everyone else.

Another place where you can define environment variables is /etc/environment. These settings will apply to everyone (you can't write arbitrary shell code there).

A third place where you can define environment variables is /etc/profile. There you can write arbitrary shell code. If you want a user-specific setting, there is the corresponding per-user file ~www-data/.profile. But this will only apply to console interactive logins; in particular it won't apply to cron jobs unless they explicitly source /etc/profile.

If you only need that PATH setting in a user crontab, you can write it at the beginning of the crontab. Note that you need the full list (PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/zend/bin), you can't use a variable substitution (PATH=$PATH:/usr/local/zend/bin won't work there).

share|improve this answer

To set a path for all users except root, edit /etc/profile or /etc/enviroment. For root or an individual user edit their .bashrc or .bash_profile in their home directories, respectively. Add the PATH=$PATH:/new/location/.

share|improve this answer

Your Answer


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.