Unlock AWS Lightsail for WordPress Updates of Themes etc

This is tailored specifically for the AWS Lightsail (Bitnami) environment.


🛠 AWS Lightsail WordPress Update Guide

Use this guide whenever you see the error: "Unable to write to your config file" during a theme or plugin update.

1. Open the Terminal

  • Log into your AWS Lightsail Console.

  • Click the SSH (Terminal) icon on your instance.

2. Unlock Permissions (To Update)

Copy and paste these commands to give WordPress temporary "Write" access:

Bash

# 1. Set folder ownership
sudo chown -R bitnami:daemon /opt/bitnami/wordpress
 
# 2. Set directory permissions
sudo find /opt/bitnami/wordpress/ -type d -exec chmod 775 {} \;
 
# 3. Set file permissions
sudo find /opt/bitnami/wordpress/ -type f -exec chmod 664 {} \;
 
# 4. Specifically unlock the config file link
sudo chmod 664 /bitnami/wordpress/wp-config.php
 
# 5. Restart Apache to apply
sudo /opt/bitnami/ctlscript.sh restart apache

3. Run Your Update

  • Go to your WordPress Dashboard.

  • Update your Theme or Plugin now. It should work perfectly.

4. Relock Permissions (For Security)

Once the update is finished, run this command to prevent unauthorized changes to your core configuration:

Bash

# Lock the config file (Read-only for the web server)
sudo chmod 640 /bitnami/wordpress/wp-config.php

📝 Key Path Reminders

  • WordPress Root: /opt/bitnami/wordpress/

  • The "Real" Config File: /bitnami/wordpress/wp-config.php

Note: On Lightsail/Bitnami, always target the file in the /bitnami/ folder (the destination) rather than the one in /opt/bitnami/ (the shortcut) when changing permissions.