How do I change file permissions for WordPress in App Services?

Jason Damisch 0 Reputation points
2024-06-21T23:45:41.13+00:00

Hello,

I am new to Azure. This is the first time using it. I have started by installing WordPress with App Services.

Installing WordPress also installs a plugin called W3 Total Cache. When I go into that plugin I get this warning message.

/var/www/wordpress/wp-content is write-able. When finished installing the plugin, change the permissions back to the default: chmod 755 /var/www/wordpress/wp-content. Permissions are currently 777.

I have tried to change the permissions on that file folder with three different ways, each way has failed.

  1. FTP Program
  2. WordPress plugin called WP File Manager
  3. Kudu

So I want to know why it is impossible to change the file permissions on a file or a folder in a WordPress for App Services. That is very different than regular commodity website hosting of which I am accustomed to.

Because you gave me that plugin and that plugin gave me a warning, it should be possible to satisfy that warning. How dangerous is it to ignore the warning? Is that different in App Services than it is in a non-cloud hosting environment?

Jason

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,270 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Sina Salam 6,581 Reputation points
    2024-06-22T04:20:08.52+00:00

    Hello Jason Damisch,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Problem

    I understand that you are experiencing difficulties in changing the file permissions of the /var/www/wordpress/wp-content directory in his WordPress installation hosted on Azure App Services. Also, you are unable to change the permissions from 777 to 755 and you are in need to understand the underlying reasons for these difficulties and the potential risks associated with ignoring the warning about file permissions in a cloud hosting environment.

    Solution

    To solve these challenges, you will need to understand basic information related to the changing of file permissions in WordPress on Azure App Services as stated below:

    • Azure App Services often restricts direct file system access for security and stability reasons. This can affect the ability to change file permissions directly.
    • W3 Total Cache plugin warns that the /var/www/wordpress/wp-content directory has permissions set to 777, which is considered less secure. It recommends setting permissions to 755.
    • Yes, you have tried using FTP, WP File Manager plugin, and Kudu console but encountered issues. This suggests typical methods might not work due to Azure's managed environment.

    So, let's take these one after the other.

    One

    To use Kudu Console for Permissions Change, you will need to access the Kudu console from the Azure portal. To do this follow these steps:

    • Navigate to your App Service > Development Tools > Advanced Tools > Go.
    • Click on Debug Console > Bash (for Linux-based App Service) or CMD (for Windows-based App Service).
    • Once in the Kudu console, navigate to the directory where WordPress is installed:
    • cd /home/site/wwwroot/
    • Change the directory permissions to 755 using the chmod command:
    • chmod 755 /home/site/wwwroot/wp-content
    • Verify the permissions have been successfully changed:
    • ls -ld /home/site/wwwroot/wp-content

    Ensure the output shows drwxr-xr-x (755 permissions).

    Two

    Azure App Service's architecture.

    Understand that certain parts of the file system might be read-only or have restricted permissions due to Azure App Service's architecture not really limitation. If direct permissions changes fail, consider alternative methods like using Azure deployment scripts or adjusting App Service configurations through Azure CLI.

    Three

    Lastly, leaving directories with 777 permissions can pose security risks, allowing anyone to write to those directories. It's crucial to adhere to security best practices by setting permissions to 755 or more restrictive settings. It is highly advice for an importance of maintaining secure configurations, especially in a cloud hosting environment where vulnerabilities can be more easily exploited.

    References

    For more reading and steps, you can leverage on the following links for your review:

    Source: Azure App Service Kudu Console. Accessed, 6/22/2024.

    Source: Understanding File System Limitations in Azure App Services. Accessed, 6/22/2024.

    Source: Managing Permissions with Kudu and Azure CLI. Accessed, 6/22/2024.

    Source: Quickstart: Create a WordPress site - Azure App Service. Accessed, 6/22/2024.

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Srinud 1,965 Reputation points Microsoft Vendor
    2024-06-28T07:39:12.85+00:00

    Hi Jason Damisch,

    Thank you for asking this question on the Microsoft Q&A Platform.
    We have tired from our end and able to change file permission successfully with the below following steps.

    You can try using the Azure portal. select particular your web app and navigate to Development Tools click on SSH you can see the option (GO) select on it.

    From there, you can change the file permissions. After changing the permissions, ensure that you log back into your web application.

    Please refer to the screenshot below for your reference as shown below:

    28-6

    28-2

    If you have found the answer provided to be helpful, please click on the "Accept answer and Upvote" so that it is useful for other members in the Microsoft Q&A community.

    Thank you.