title: How to determine files that apache "cannot open for reading" in error log
body: <p>My apache error log is full of </p>
  
  <pre><code>Error opening file for reading: Permission denied
  Error opening file for reading: Permission denied
  Error opening file for reading: Permission denied
  </code></pre>
  
  <p>etc.</p>
  
  <p>How can I determine the file or folder of files that is causing this permissions error? There's no direct relation between errors appearing and access_log requests.</p>
  
  <p><a href="https://askubuntu.com/questions/159572/how-to-determine-file-in-error-opening-file-for-reading-error">Googling suggests</a> I should use <strong>strace</strong> but when I do </p>
  
  <pre><code>strace apache2 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>strace -etrace:open apache2
  </code></pre>
  
  <p>the response is verbose and since I haven't really used this tool successfully before, I'm not sure what to look for. Here's a trace of what appears.</p>
  
  <pre><code>.....
  open("/lib/x86_64-linux-gnu/libnss_nis.so.2", O_RDONLY|O_CLOEXEC) = 3
  open("/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
  open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
  apache2: bad user name ${APACHE_RUN_USER}
  </code></pre>
  
  <p>The last line is the only one that seems it might be the cause, but my webserver is processing images, and all sorts of disk stuff that would be a problem if the apache user wasn't sufficient.</p>
  
  <p>Thanks.</p>