Skip to content

Instantly share code, notes, and snippets.

@taeo
Created August 21, 2025 17:44
Show Gist options
  • Select an option

  • Save taeo/bc82844ffcbd08430d4f2b00ad9f2069 to your computer and use it in GitHub Desktop.

Select an option

Save taeo/bc82844ffcbd08430d4f2b00ad9f2069 to your computer and use it in GitHub Desktop.
Bitnami Lightsail - Tweaks for permissions when adding additional ssh users.
#!/bin/bash
#################################################################################################
#
# RESET ALL FOLDER / FILE PERMISSIONS + ASSIGN CORRECT USER:GROUP.
#
# Because users other than "bitnami" are making changes, it can cause permissions issues.
#
# Usage: ./reset-permissions.sh
#
# We configure the permissions of the WordPress' files by setting bitnami as the user owner and
# daemon as group owner of the files. This configuration allows you edit the files using the
# bitnami user and the webserver can use the daemon group to do the same. However, if you make
# changes to the application using the web interface (install plugins or themes), those new
# files are owned by daemon:daemon (the Apache and PHP-FPM services use that user and group
# so they generate the files using those permissions configuration) and you won't be able to
# edit them unless you use the command line and sudo. In that case, you can run the following
# commands to be able to edit those files using the bitnami user
#
# Users will need sudo access to run this script
#
##################################################################################################
# Reset all folder / file permssudo
find ./ -type d -exec chmod 775 {} \;sudo
find ./ -type f -exec chmod 664 {} \;
# Make sure everything is set back to the bitnami user and daemon group
sudo chown -R bitnami:daemon ./
# Lock down wp-config.php
sudo chown root:root wp-config.php
sudo chmod 640 wp-config.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment