Change folder permissions to 755 by running the below command.
find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \;
To change file permissions to 644, our command is as follows.
find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;
In my case, /path/to/your/wordpress/install/ will be replaced by /var/www/html/ so my command would be as below.
find /var/www/html/ -type d -exec chmod 755 {} \;
find /var/www/html/ -type f -exec chmod 644 {} \;
In the above commands, -type d for directories and -type f for files.
Note: Never give 777 permission to any file or directory, even upload directories. If any file has 777 permission that means we are making this file World-Writable. This should not be acceptable.