1

An example: Say Apache needs to have ownership of all the files in /var/www/html to serve the pages of a website. Is there any danger in making Apache the owner of this directory (and files and sub-directories), rather than just assigning ownership to the files and maintaining the current directory ownership? It seems like a less precise solution, and less precise solutions always seem to be insecure for reasons I haven't thought of.

It's basically a question of using

cd /var/www/html
chown -R user .

Versus

chown -R user /var/www/html

Thank you!

closed as off-topic by Andrew B, mdpc, Ward, Jenny D, dawud Mar 19 '14 at 19:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – Andrew B, mdpc, Ward, Jenny D, dawud
If this question can be reworded to fit the rules in the help center, please edit the question.

  • To serve the files apache only needs to be able o read them. – Iain Mar 17 '14 at 19:27
3

Those two (sets of) commands do the same thing. . is "the current working directory".

In answer to the question you're actually asking, though - the difference is that when chowning just the files, Apache will not be able to create any new files in /var/www/html, only in subdirectories that were chown'ed.

0

You are fine only assigning ownership to sub files as long as

(a) apache does not need to create new files

(b) the execute bit (x) it turned on for all in the parent directory (needs this in order to cd into that directory)

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