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
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.
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.
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/