I am trying to set permissions with
sudo 775 - R /var/www/
on all folders and all files in the www
folder of lamp for sudo user
.
Is this the correct way to set up the system?
I am trying to set permissions with
sudo 775 - R /var/www/
on all folders and all files in the www
folder of lamp for sudo user
.
Is this the correct way to set up the system?
The proper permission under /var/www/ is 755 for folders and 644 for files.
The value for 755 is readable by User, Group, and World, writable by User, executable by User, Group, and World. For uploading folder it should be different, and you should change manually.
Whereas the value for 644 is readable by User, Group, and World, but writable only by User.
The short command to set folder and file under /var/www/ to 755 and 644 is:
find /var/www -type d -exec chmod 755 {} \;
find /var/www -type f -exec chmod 644 {} \;
These are simple commands so you will get all folder and files into these permissions, of course, that is not the best practice, it would better if you set spesifically the folders or files that you want to set (I edit this answers after considering comments from AzkerM).
/var/www
directory is not a good practice though. Instead OP can try assigning permissions to the necessary directories as needed. – AzkerM May 14 '14 at 07:43www
directory will face the public. A simple permission issue can cause lots of problems. Keep up your good work. :) – AzkerM May 15 '14 at 11:07