Skip to content

WordPress Plugin Update Fails Due to File Permissions on Lightsail Instance

0

Hello AWS Support Team,

I am running a WordPress site on an Amazon Lightsail instance and have been encountering an ongoing issue with updating a plugin (specifically, “Accelerated Mobile Pages”). Every time I attempt to update, I receive an error stating:

“The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.”

I have already taken the following steps:

Checked and Reset File Permissions/Ownership:

Connected via SSH to my Lightsail instance Ran commands such as: bash 코드 복사 cd /opt/bitnami/wordpress sudo chown -R bitnami:daemon . sudo find . -type d -exec chmod 775 {} ; sudo find . -type f -exec chmod 664 {} ; sudo chmod 640 wp-config.php Restarted Apache (sudo /opt/bitnami/ctlscript.sh restart apache) Verified Disk Space:

Confirmed there is sufficient disk space using df -h Removed any unnecessary logs (/opt/bitnami/apache2/logs/* and /tmp/* if needed) Disabled Security/Cache Plugins:

Deactivated security-related and caching plugins to avoid potential file-access restrictions Ensured FS_METHOD Is Not Duplicated:

In wp-config.php, I verified define('FS_METHOD', 'direct'); appears only once Tried Manual Plugin Update:

Downloaded the latest ZIP from WordPress.org, replaced the folder, reapplied correct permissions, etc. Despite these efforts, the plugin still fails to update automatically and throws the same “cannot copy files” error. I have also checked the Apache error logs, but it does not clearly indicate which files or directories are blocked.

Could you please advise if there are any Lightsail-specific settings or constraints that might still be preventing file operations within /opt/bitnami/wordpress/wp-content/plugins? I would appreciate any guidance on whether something like SELinux, ACLs, or another underlying permission mechanism could still be interfering.

Thank you for your time and assistance.

asked 2 years ago813 views

1 Answer
0

Thank you for providing such a detailed description of the issue you're facing with your WordPress plugin update on your Amazon Lightsail instance. It seems you've already taken many of the recommended steps to resolve file permission issues. However, there are a few additional things we can try to resolve this problem.

First, let's ensure that the Apache web server has the necessary permissions to write to the WordPress directories. The Bitnami WordPress stack on Lightsail uses a specific user and group for running Apache. Try the following commands:

sudo chown -R bitnami:daemon /opt/bitnami/wordpress
sudo chmod -R 775 /opt/bitnami/wordpress

This will set the ownership to the bitnami user and daemon group, which should align with the Apache configuration.

Next, let's check if there are any specific permission issues with the plugin directory:

sudo chmod -R 775 /opt/bitnami/wordpress/wp-content/plugins

If the issue persists, we can try to temporarily disable the Apache security module mod_security, which might be interfering with file operations:

sudo /opt/bitnami/apache2/bin/apachectl -k stop
sudo /opt/bitnami/apache2/bin/httpd -f /opt/bitnami/apache2/conf/httpd.conf -D FOREGROUND

This will start Apache without mod_security. Try updating the plugin now. If it works, you'll need to investigate your mod_security configuration for overly restrictive rules.

Another approach is to use WordPress's built-in file system method. Add the following to your wp-config.php file:

define('FS_METHOD', 'direct');

If it's already there, try changing it to:

define('FS_METHOD', 'ftpext');

You might also want to check if there are any .htaccess files in the plugin directory or its parent directories that could be restricting access. Look for files named .htaccess and review their contents.

Lastly, if none of these solutions work, you might want to consider creating a new WordPress instance in Lightsail and migrating your content. Sometimes, underlying configuration issues can be difficult to track down, and starting fresh with a new instance can resolve persistent problems.

Remember to revert any temporary changes and restart your Apache server after testing:

sudo /opt/bitnami/ctlscript.sh restart apache

If the issue continues after trying these steps, you may need to engage with Lightsail support for a more in-depth investigation of your specific instance configuration.
Sources
Community | Securing Wordpress on Lightsail: Hardening Wordpress
Secure your Lightsail WordPress instance with free Let's Encrypt SSL certificates - Amazon Lightsail
Configure WordPress with a Lightsail content delivery network - Amazon Lightsail

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.