Added xtra chown to ensure correct perms on every container start #57
Reference in New Issue
Block a user
No description provided.
Delete Branch "kawaiipunk/wordpress:main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #56
The Bug
The
chown www-data:www-datais applied only to the.htaccessfile, and only inside theifblock (i.e., only on first run when.htaccessdoesn't exist yet). Theuploads/directory itself — created bymkdir -p— is never chowned. It staysroot:root.Additionally, on subsequent deploys where
.htaccessalready exists, the entireifblock is skipped, so no chown happens at all.The Fix
Add a
chownon theuploads/directory outside theifblock, so it runs on every startup:The added line
chown -R www-data:www-data /var/www/html/wp-content/uploads/ensures that:uploads/directory itself is owned bywww-data(not just the.htaccessinside it)-Rflag covers any files/subdirectories that may have been created asroot(e.g., by backup restores or other processes)This is safe to run repeatedly —
chownon already-correct ownership is a no-op, and theuploads/directory is typically small enough that the recursive operation is negligible.Sorry for introducing this bug and thank you for fixing it.
@ -55,6 +55,8 @@ EOFchown www-data:www-data "$UPLOADS_HTACCESS"Maybe this line can be deleted, because it's redundant with
chown -Ron/var/www/html/wp-content/uploads/You're right! Just done that.