title: How do I figure out what user & group Apache is running as?
body: <p>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 <code>.htpasswd</code> file instead of giving it insecure permissions. I don't think I have access to the <code>httpd.conf</code> file, so I can't use this method to <a href="http://ubuntuforums.org/showthread.php?t=263064" rel="noreferrer">find what user Apache runs as</a>. Also, running <code>top</code> or <code>ps aux</code> only shows the processes I'm running but doesn't show the apache process.</p>
  
  <p>Based on the output from <code>cat /etc/passwd</code> and <code>cat /etc/group</code>, I'm guessing it's <code>www-data</code>.</p>
  
  <p>Well, I followed the instructions for <a href="http://wiki.dreamhost.com/Password-protecting_directories" rel="noreferrer">Password-protecting directories on Dreamhost</a>. It generated a directory with a <code>.htpasswd</code> file with the group <code>dhapache</code> and permissions <code>440</code>. It also put a <code>.htaccess</code> file in there with under my group. For some reason, when I try <code>chgrp dhapache test_file.txt</code> I get <code>chgrp: changing group of 'test_file.txt': Operation not permitted</code>. So, I just moved the <code>.htpasswd</code> file that DreamHost generated to where I wanted it and edited the <code>.htaccess</code> file it generated, despite its warnings.</p>