Search code examples
wordpressazureazure-web-app-service

Wordpress File Permissions in Azure


UPDATE: I found I was making a mistake when setting the file & folder permissions, and had accidentally been setting the folders to 644 as well (causing the site to crash). When the files & folders were set properly, everything worked perfectly.

New issue however - Azure's servers are now resetting the file permissions within a few minutes of me changing them. Is there anything I can do to fix this?


OLD ISSUE:

I recently moved my website to a Microsoft Azure Web App running wordpress, using the default settings provided by Microsoft for the setup. The app runs without any issues, however while in SSH/FTP I noticed that all of the wordpress files and folders are owned by nginx and have 777 permissions. As this seems to be a security risk, I changed the folder permissions to 755 (no issue) and the file permission to 644 - but the site refuses to even open without the permissions set to 777. Is this a security risk, and if so, what can I do to secure my wordpress site on Azure?

I tried to change the file permissions via SSH to 644, causing the wordpress site to no longer load


Solution

  • Azure's servers are now resetting the file permissions within a few minutes of me changing them. Is there anything I can do to fix this?

    Assuming you're using the app setting WEBSITES_ENABLE_APP_SERVICE_STORAGE, this is expected behavior and cannot be changed:

    When you persist storage with the WEBSITES_ENABLE_APP_SERVICE_STORAGE app setting, we mount a location in Azure Storage to the /home mount point. The permissions on this are 777. You cannot change these permissions, even if you attempt to do so from an initialization script or from SSH.

    (Source)