Set WordPress file permissions in terminal

How to set your WordPress file permissions in terminal.

cd in to your root of your webserver:

cd /var/www/html/

Then change roles and group to:

sudo chown -R www-data:www-data wordpress

This line will change all folder permission to 755:

sudo find /var/www/html/wordpress -type d -exec chmod 755 {} \;

This line will change all files permission to 644:

sudo find /var/www/html/wordpress -type f -exec chmod 644 {} \;

This line will change wp-config.php to 440:

sudo chmod 440 /var/www/html/wordpress/wp-config.php

Restart your nginx:

sudo systemctl restart nginx
sudo systemctl restart php8.3-fpm


Tips and tricks


Comments are closed