I have one directory called apps/cache. When a script writes some files to that directory those files are owned by the nobody user. Of course, then those files and folders are not editable by any user.

Is there any way that I can change the user nobody?


Use suEXEC within Apache to run your scripts as an appropriate user.

Also, consider learning a lot about setuid. A lot.

  • I did that chmod g+s directory. Now what that did is make the new folders with group of the cache directory. Then i tried umask 002 cache so that i can get default group write permission. But its not doing that – Randhir Singh Jan 9 '12 at 5:14
  • @user1094163 Do you want to change how apache behaves in the first place, or try and get the situation as it stands now to work? The answer I gave is to make apache and scripts behave better, but not how to get things to work now that the folder and files are under the nobody user. – Wesley Jan 9 '12 at 6:14
  • Thats apache thing is looking bit tough for me. can you solve my current problem as per now – Randhir Singh Jan 10 '12 at 7:30

Check your configuration (apache) for the directive User. This is where you set the user apache starts and operates in the first place.


check these variables in your configuration folder and change accordingly

x@x:~$ grep www-data /etc/apache2/ -R
/etc/apache2/envvars:export APACHE_RUN_USER=www-data
/etc/apache2/envvars:export APACHE_RUN_GROUP=www-data

Some Centos setups may have Apache settings under "httpd"

  1. make a backup of /etc/httpd/conf/httpd.conf
  2. edit /etc/httpd/conf/httpd.conf
  3. find the lines starting with User and Group - create them if they don't exist.

    User mycustomapacheuser
    Group mycustomapachegroup

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.