Security glossaryFile permissions decide who can read, write, and run each file and folder on a server. WordPress recommends 755 for folders and 644 for files.
File permissions decide who can read, write, and execute each file and folder on a server. On Linux they are written as three digits, for the owner, the group, and everyone else: 4 is read, 2 is write, and 1 is execute, so 6 means read and write and 7 means all three.
Settings for WordPress
- Folders:
755(or750). - Files:
644(or640). wp-config.php, which holds the database password: tighter, such as440,400, or600, depending on how the server runs PHP.
Why 777 is a red flag
777 lets every user and process on the server change the file. If an attacker gets any foothold, they can then rewrite your site's code. A plugin or guide that asks for 777 should be questioned.
Source: WordPress Advanced Administration: Changing file permissions.