DEV Community


WordPress File Permissions/Privileges Best Practices

So proud to be a coder
・1 min read

3 very important general rules:

All files should be 664.
All folders should be 775.
wp-config.php should be 660.

A quick way to do this:

For example, I copied the whole 'themes' folder from local to server, replaced the old one on server. Then I have to carefully manipulate the chown and chmod:

# dive into 'wp-content' folder, 
# where contains 'themes' folder.
cd /A/CERTAIN/PATH/wp-content

# change privilege of 'themes'
sudo chmod 775 themes 

# ATTENTION! For I am currently using 
# 'Bitnami WordPress Production-Ready 
# Stack Deployment On AWS' solution, 
# I confirmed before replacing 'themes', 
# the original group is 'root' and 
# owner is 'daemon'. So please confirm 
# yours before do this step.
# This step is to change 'themes' OWNERGROUP 
# to 'root' and OWNER to 'daemon'.
sudo chown -R root:daemon themes 

# dive into 'themes'
cd themes

# change all files to 664
sudo find . -type f -exec chmod 664 {} + 

# change all folders to 775
sudo find . -type d -exec chmod 775 {} + 
Enter fullscreen mode Exit fullscreen mode

Inspired by Benjamin's detailed article @

Hope this helps!
So proud to be a coder!

Discussion (0)