fix permission

I prefer to own all the directories and files (it makes working with everything much easier), so I do:

## Webserver as owner (the way most people do it):

sudo chown -R www-data:www-data /path/to/your/wordpress/root/directory

#Assuming `www-data` is your webserver user.
sudo usermod -a -G www-data ubuntu

sudo chown -R my-user:www-data /path/to/your/wordpress/root/directory

sudo chgrp www-data /var/www/html/wordpress/wp-config.php

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

#Then I give both myself and the webserver permissions:

sudo find /path/to/your/wordpress/root/directory -type f -exec chmod 644 {} \; 

sudo find /path/to/your/wordpress/root/directory -type d -exec chmod 755 {} \;

sudo find /var/www/html/wordpress/wp-content -exec chgrp www-data {} \;
sudo find /var/www/html/wordpress/wp-content -type d -exec chmod 775 {} \;
sudo find /var/www/html/wordpress/wp-content -type f -exec chmod 664 {} \;

## Step 5: privatize wp-content 
echo '::STEP 5/5:: Privatize /wp-content (Set 755)'
sudo chmod 755 /var/www/html/wordpress/wp-content

Source: https://github.com/ieselisra/wordpress_fix_permissions_debian10/blob/main/fix_wordPress_permissions.sh