1

is it correct if i change all files permisson to 644 and all folders to 755 using following commands?

find . -type f -print0 | xargs -0 chmod 0644
find . -type d -print0 | xargs -0 chmod 0755

2 Answers 2

0

No. For one thing, mage should be executable. Also, your database password is in app/etc/local.xml, so you want to make that not readable by world. You don't really need find to accomplish setting the permissions. From the mage root:

chmod -R -x . # remove execution bit from everything
chmod o-r app/etc/local.xml
chmod +x mage
chmod -R ug+rwX . # make files read/write, dirs rwx for owner and group

This doesn't reset the permissions for other users other than for app/etc/local.xml.

2
  • chmod -R -x . command remove my all folders. Thanks
    – abu abu
    Commented Apr 3, 2017 at 13:18
  • chmod cannot remove directories. It will make directories not-executable, which could give you the impression they were removed. Continue with the instructions and it will be fine.
    – kojiro
    Commented Apr 3, 2017 at 15:59
2

Yes, those commands are technically correct in terms of using chmod to affect those changes.

The permissions you listed are fine if the server you are on is running PHP / the webserver as your FTP user, and all files and directories are owned by you. This would be the case with php-fpm, or PHP as a CGI and using suphp.

If however, your host is running PHP as mod_php, and Apache is set to a generic "nobody" or "www" user, then a few directories (recursively) need to be world writable (chmod 0777):

var/
downloader/
media/

Your Answer

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

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