In this video I will show you how to fix file and folder permission issues on your Lightsail WordPress install.
If you manage a WordPress site using the Bitnami blueprint in Lightsail, you may run into permission errors. These errors are mostly in two areas:
1. If you are trying to update a file using SFTP or SSH; you get a permission denied error and that prevents you from updating files in WordPress installation folder.
2. If you have a plugin or theme that needs to write to a folder and it is getting a permission denied error.
In both of these cases, most of the time the problem comes down to permissions.
Bitnami sets up two users and groups in its Lightsail image. The Bitnami user which is what you would use to SFTP or SSH and modify files and Daemon user which is what the Apache web server runs as and access the WordPress files and folder to serve pages for your website.
So how do the permissions get messed up? Its probably a variety of scenarios but likely if you go into the wp-admin and update plugins, themes then the web server may set the plugins folder permissions to daemon. And therefore if you login as Bitnami user you will not be able to modify those same files. This can happen in reverse too where you may create a folder that is meant to be accessed by some PHP code and it isn’t able to do so because the owner is set to Bitnami. There could be other reasons too.
There are easy steps to fix this and below are those steps:
Steps:
- SSH into your server using Bitvise SSH client or the web-based SSH client in Lightsail
- Set the owner to user bitnami and group daemon
sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs
- Set the write permissions for folders
sudo find /opt/bitnami/apps/wordpress/htdocs -type d -exec chmod 775 {} \
;
- Next the WordPress files needs read and write permissions for the owner and group so set that with this command:
sudo find /opt/bitnami/apps/wordpress/htdocs -type f -exec chmod 664 {} \;
All videos tutorials on the website as well as the YouTube channel aim to provide a simplified process for a specific scenario; there could be many different factors and unique use cases you may have. The tutorials may not cover every situation; so treat is as a starting point or learning concept to apply to your unique situations, and consider this inspiration but not prescription or explicit direction.