Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I figure out what user & group Apache is running as?

On DreamHost shared hosting, I'm setting up htpasswd, but Apache does not have permission to read the file. How do I give it permission? I want to either change the owner or group of the .htpasswd file instead of giving it insecure permissions. I don't think I have access to the httpd.conf file, so I can't use this method to find what user Apache runs as. Also, running top or ps aux only shows the processes I'm running but doesn't show the apache process.

Based on the output from cat /etc/passwd and cat /etc/group, I'm guessing it's www-data.

Well, I followed the instructions for Password-protecting directories on Dreamhost. It generated a directory with a .htpasswd file with the group dhapache and permissions 440. It also put a .htaccess file in there with under my group. For some reason, when I try chgrp dhapache test_file.txt I get chgrp: changing group of 'test_file.txt': Operation not permitted. So, I just moved the .htpasswd file that DreamHost generated to where I wanted it and edited the .htaccess file it generated, despite its warnings.

like image 727
ma11hew28 Avatar asked Nov 30 '10 18:11

ma11hew28


1 Answers

Actually, you don't need access to httpd.conf:

ps aux | grep apache2
groups apache_user

should yield what You want

like image 81
barti_ddu Avatar answered Sep 22 '22 21:09

barti_ddu