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 used

[root ~]$ echo "umask 002" >> /etc/sysconfig/httpd
[root ~]$ service httpd restart

restarted apache many times but whenever i install something from script the directories are still not group writable.

What should i do

I have checked the file the umask 002 is at the end of file

share|improve this question
setting up an ftp server seems like it really would be easier for you. and potentially more secure. as you mentioned in a comment on my deleted question; you want to allow people to create files in their home directories. why does it have to be through httpd? – cpbills May 19 '10 at 2:49
Actually that's web host server. Now i am using joomla. I need to install new plugins and extensions , those extension create their own directories and files. I found that if need to change e files i don't have proper permission , i have to go to root to change those permissions – John May 19 '10 at 2:55
well, yeah, that's kind of how the linux world works. you use root to admin globally, not /everything/ on the system will be run as your non-privileged user. i'm guessing the plugins were installed as user www-data ? – cpbills May 19 '10 at 2:57
apache runs as user www-data on most systems, or some form, thereof. when a script on an httpd server creates files, it is creating them as the user the server is running as (www-data) or the user who owns the files IF you are using something like SuPHP. otherwise, as root, you need to give your httpd server a directory to write to, so the scripts can install their modules and the like. you ultimately use the web interface to manage those apps, and you should not have to do anything at the shell level. aside from configuration, perhaps, as root, unless script is in /home/user/public_html – cpbills May 19 '10 at 3:06
The owner is coming as nobody. Yes the scripts are in /home/user/public_html directory – John May 19 '10 at 3:37

That's one of the standard ways to specify the umask for Apache in CentOS. If your init script (/etc/rc.d/init.d/httpd) sources the /etc/sysconfig/httpd file, either the umask is not specified or something is overriding it.

How are the files being created?

share|improve this answer
i found the information about putting umask in Location and it was probably referring to an older version of apache,… i also think i was wrong, so i deleted my answer. – cpbills May 19 '10 at 2:43
Ah, interesting. I did a quick search of the 2.2 docs on the Apache site and couldn't find anything. You've had some good answers, don't let that discourage you! – Warner May 19 '10 at 2:55
The files are created by webiste script insdie the /home/user/www folder – John May 19 '10 at 2:56
By what? PHP script, Perl script? CGI? mod_perl? What are they doing? This could affect the performance. – Warner May 19 '10 at 2:56
By PHP script , more info is given my other comments to cpbills – John May 19 '10 at 4:25

is nobody the user apache is running as? this is fairly common, apache, www-data and nobody are all fairly common. try ps ax | grep apache and see what shows up in the first row, and double check your configuration.

if nobody is the user apache is running as, then you will want to do sudo chown nobody.nobody /var/www/whatever/directory/ to change the ownership of the directory that apache needs rwx permissions to to nobody group nobody

then apache will be able to create files in that directory, and the subsequent scripts will be able to download/install their plugins, etc into the directory as well.

then, as i said before, you will manage the plugins and scripts, etc from the web interface, NOT from the shell.

in your apache httpd configuration file, there is a line that says User username where username is the name of whatever user apache httpd is run as on your system. your configuration file is potentially located at /etc/apache2/apache2.conf but it could be different, especially if you're running an older (1.x) version of apache's httpd.

share|improve this answer

Your Answer


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