skip to Main Content

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

2

Answers


  1. 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?

    It’s concerning that changing the file permissions to 644 causes your WordPress site to stop loading. This indicates that some files or directories might require additional permissions to function properly.

    Here I have set the permissions accordingly, You can see the below command to change the permission.

    // went to logfiles directory.
    
    cd /home/logfiles
    
    //Changing permissions.
    
    chmod 755 /home/LogFiles
    chmod 644 /home/LogFiles/2024_02_01_pl1sdlwk000Z65_docker.log
    chmod 644 /home/LogFiles/__lastCheckTime.txt
    chmod 755 /home/LogFiles/kudu
    chmod 755 /home/LogFiles/webssh
    
    • rwxrwxrwx – Each group of three characters follows the same pattern: "r" for read, "w" for write, and "x" for execute. If a permission is granted, the respective letter is shown; otherwise, a hyphen ("-") is shown.

    enter image description here

    • In "-rw-r–r–", "rw-" means the owner has read and write permissions, "r–" means the group has read-only permissions, and "r–" again means others have read-only permissions.

    If you want to apply this permission recursively to all subdirectories and files within the specified directory, you can add the -R option chmod -R 755 directory_name.

    Login or Signup to reply.
  2. 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)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search