2

I have a NAS running Linux with a Apache 2.2. I want the apache process (running as user nobody) to run as different group "users" to read some files. I tried the following without success:

  • in its httpd.conf change to "Group users"
  • run "addgroup nobody users"

But the apache still shows a 403 permission error for a file like this

-rw-rw-rw- 1 foo users 2654256 Jul 21 12:57 test3.png

Do you have any solution for that?

1 Answer 1

1

Apache2 Environment Variables

It would be useful to know what Linux version and release distro the NAS is running due to the fact that Apache2 can be setup in various ways depending on what version of linux your using.

Sometimes you need to edit etc/apache2/envvars

gedit /etc/apache2/envvars

Change:

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

to:

#export APACHE_RUN_USER=www-data
export APACHE_RUN_USER=nobody
#export APACHE_RUN_GROUP=www-data
export APACHE_RUN_GROUP=nobody

Directory Ownership

Additionally you will then be required to update the ownership of www folder which can normally in /var/www but again can vary from Linux to another.

Once you have located the folder you will need to do a chown on it to make nobody the owner of the folder. You can do this by running: chown nobody:nobody -R /var/www

4
  • The Linux kernel is 3.x and it based on busybox. There is no envvars file in the apache conf directory. I tried to put the APACHE_RUN variables to some rc-scripts but it also didn't helped.
    – tardis
    Commented Sep 1, 2014 at 7:43
  • Have you run chown? Commented Sep 1, 2014 at 10:23
  • Yes, chown would solve the problem for current files but not for future files that have the wrong permission. I would have to run chown for each new file or every 5 minutes that I do not want.
    – tardis
    Commented Sep 1, 2014 at 11:18
  • Err...? You'd only need to repeatedly chown. You need to run chown the once because the configuration doesn't update the file permissions when doing such changes. If your having to repeat chown its because you do not have Apache2 running as nobody. I'm failing too see the problem, please do a ps -U nobody or use htop and check what Apache2 is running under. Commented Sep 1, 2014 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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