I'm running a web server on my (virtual root) server where a friend is allowed to host his own page. This page is sitting in his home directory and the Apache is configured in such a way that a VirtualHost is using that directory as DocumentRoot. The access.log and error.log for that VirtaulHost are located in /var/log/apache2 as VirtualHost specific files.

All of this is working nicely - but my friend doesn't have permission to read anything inside /var/log/apache2, of course.

How can I grant him read permissions for those files without exposing anything else in /var/log/?

(The naive ln -s /var/log/apache2/friend.access.log in his home directory didn't work, of couse...)

| improve this question | | | | |
  • What are the current permissions for /var/log/apache2? – cpast Oct 20 '14 at 20:30
  • drwxr-x--- for root:adm (and the same holds for /var/log) – Chris Oct 20 '14 at 20:37

To read a file on a Unix system, you need the x permission bit on all levels of parent directory, and the r permission bit on that file. In your case, for instance, friend would need x on /var, /var/log, and /var/log/apache2, in addition to r on /var/log/apache2/friend.access.log. You could do this via ACLs if you don't want to give all users permissions to read files in /var/log even if they have r permissions on that file and know the exact path.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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