Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Method 1: Via apache2.conf (or httpd.conf):

<Directory "/var/www/html">
  Options Indexes FollowSymLinks -MultiViews
  AllowOverrides None
  Order allow,deny
  Allow from all
</Directory>

Method 2: Chmod in the command-line.

Doesn't both these methods accomplish the same thing?

And another Q if you can answer it, what permissions is the var and www folder usually set to?

Thanks

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Method 2 set permission on file system level, so not only for Apache. This is the secure way to set permission on a file.

Method 1 set permission on application layer but Method 2 also apply. If your content can't be read by Apache, then even if Method 1 tells that the client can read the file it will not be able to do it.

So the quick answer is No.
Method 2 will be used to ensure that Apache can read your php file but other users/process can't. Method 1 will be used to protect page access with a password, etc...

I see you set the PHP tag, take care that Method 1 will never affect what a PHP could read or write. Method 2 as well as PHP configuration will do it.

/var is 755 root/root on my system, www will highly depend on your apache configuration and security you need.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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