I recently copied all files to other directory and it seems all files and folder permission changed so I run

find . -type f -exec chmod 644 {} ;
find . -type d -exec chmod 755 {} ;

and I still got some issues with file or folder permission

for example, I got this error when I try upload a product image

'Destination folder is not writable or doen't exist'

but the issue solved after I changed this folder and all sub folders permission to 777 /www/media/tmp/catalog

I also got some modules error which works from old one (I solved some after I changed to permission 777) .. so I guess I need to setup files and folder permission correctly

What folder and files I have to setup as permission 777 to prevent other issue?

1 Answer 1


777 should never be used.

For a Magento installation, after it has been installed, the entire document root should be unwritable by the web server user (with some exceptions). They should be owned by a user other than the web server user. The only directories that should be writable should be the /media and /var directories and their write permissions should be denoted by file ownership, not chmod perms. Opening file permissions beyond this opens your webserver to an increased number of attack vectors.

So, chmod 755 for directories, 644 for files, owned by a non-webserver, non-root user with next to no system permissions, exception for /media and /var which should have the same perms, but owned by the web user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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