I have changed ownership of my localhost file on /var/www/ and its sub folders and given it permission 777. However, whenever I add a new folder in it the new folder does not automatically get that permission. How can I give a folder 777 permission forever so that if I add a new folder or file it gets the same permission?
|
|
||||
|
Permissions for newly created files are set by |
||||
|
As others have already mentioned, giving 777 permissions on A better solution would be to give write permissions only to the users who needs to modify the files. One of the ways to do that is:
Another option would be to use ACL, again, to give write permissions only to users who need them. Here are detailed instructions on serverfault. Generally, the webserver or other network services or system user accounts should have no write permissions to the files served by the webserver, as this opens a possibility of arbitrary code execution. |
||||
|
|
|
You should edit Example: ALT+F2 Go to the end of the file and add a line Where umask is the binary opposite of the desired permissions value. Save. Restart apache. Example: This will only affect files/folders that are newly created by the apache user. Additional note, read and write is 6 in the user, group, or anyone slot. |
||||
|
|
|
Also, some "out of the box" solution is to configure your http server to use different folder. If You use Apache, simply edit it config files. This way You do not have to change permissions for /var/www witch can be bad idea (potential security issues). And umask is answer for Your question. It can be used to restrict default privileges for newly created folders and files. And distribution developers tend to use it to restrict access to some system folders. |
||||
|
|
|
I think you want to have write access to
and run |
|||
|
|

find . -type d -exec chmod 777 {} +to change all directories to 777. Remember, you must be logged in as root for better results, and make sure you are in the folder. – Ida Bagus Redy Santiawan Aug 14 '12 at 5:58