How to set correct permissions on files and directories?

How to set correct permissions on files and directories?

Sometimes you need to recursively set permissions on files and folders, but we have a lot of files and folders and it is inconvenient to write chmod every time.
So we go via SSH, go to the desired directory and execute:

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

This will set permissions 755 for all folders and 644 for all files in the directory we are in.