I am trying to recursively change the permission of all files and directories in my project.
I found a post on the magento forum saying that I can use these commands:
find ./ -type f | xargs chmod 644
find ./ -type d | xargs chmod 755
chmod -Rf 777 var
chmod -Rf 777 media
It worked for find ./ -type d | xargs chmod 755.
The command find ./ -type f returned a lot of files, but I get chmod: access to 'fileXY.html' not possible: file or directory not found on all files, if I execute find ./ -type f | xargs chmod 644.
How can I solve this?
PS: I know that he recommended to use 777 permission for my var and media folder, which is a security risk, but what else should we use?
chmodfromfinddirectly with-exec chmod 644 {} +. – Kusalananda Jun 01 '18 at 14:06print0is a GNU platform-specific extension and not available to the POSIX standardfindcommand. LIkewise with the-0option to xargs. – Andrew Henle Jun 03 '18 at 12:17chmodstandalone variant is POSIX-compliant (but I’m not sure it’s supported on macOS, despite the latter being certified Unix). – Stephen Kitt Jun 03 '18 at 12:37