2

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

  • 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 02: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 –  May 19 '10 at 02: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 02: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 03:06
  • The owner is coming as nobody. Yes the scripts are in /home/user/public_html directory –  May 19 '10 at 03:37

2 Answers2

1

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?

Warner
  • 23,756
  • 2
  • 59
  • 69
  • i found the information about putting `umask` in `Location` and it was probably referring to an older version of apache, http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/ref-guide/s1-apache-config.html i also think i was wrong, so i deleted my answer. – cpbills May 19 '10 at 02: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 02:55
  • The files are created by webiste script insdie the /home/user/www folder –  May 19 '10 at 02:56
  • By what? PHP script, Perl script? CGI? mod_perl? What are they doing? This could affect the performance. – Warner May 19 '10 at 02:56
  • By PHP script , more info is given my other comments to cpbills –  May 19 '10 at 04:25
  • Just want to chime in because I'm having this same issue but 5 years later. Did you ever find a solution? – Dylan Pierce Oct 15 '15 at 23:10
0

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.

cpbills
  • 2,720
  • 18
  • 12