WordPress – unable to create directory

Updated: 16 January 2022

Resolution for ‘Unable to create directory’ error in WordPress.

This error is caused by an inappropriate set of folder and file permissions. The following statements assume you have shell access to the document root of your webserver.

Set owner and group of each folder and file to the webserver user
sudo chown -R www-data:www-data /var/www/html

Set permissions for all folders to 755
sudo find /var/www/html -type d -exec chmod 755 {} \;

Set permissions for all files to 644
sudo find /var/www/html -type f -exec chmod 644 {} \;

For problems uploading images, also check the uploads folder is set appropriately in WordPress Dashboard > Settings > Media. If already set to the default wp-content/uploads, this field may not be visible.

Leave a comment