Jan 08

WordPress correct permissions to enable (automatic / web-based) updating

Category: WWW   — Published by goeszen on January 8, 2018 at 5:38 pm

In case you are presented with the manual / FTP update dialog when you want to update a WordPress installation via the web UI, and in case reading all the How-Tos on the web has gotten you nowhere, here's the important detail you might have overseen:

As per these docs,

WordPress determines what method it will use to connect to the filesystem of your server based on the file ownership of your WordPress files. If the files are owned by the owner of the current process (i.e., the user under which the web server is running), and new files created by WordPress will also be owned by that user, WordPress will directly modify the files all by itself, without asking you for credentials.

WordPress won't attempt to create the new files directly if they won't have the correct ownership. Instead, you will be shown a dialog box asking for connection credentials. It is typical for the files to be owned by the FTP account that originally uploaded them. To perform the update, you just need to fill in the connection credentials for that FTP account.

Whether your files are owned by the web server user, or not, will depend on how you installed WordPress and how your server is configured. On some shared hosting platforms, it is a security risk for the files to be owned by the web server user and not a FTP user. See the tutorial on Changing File Permissions for more information, including how to configure file permissions so that multiple FTP users are able to edit the files.

Read that again, the files need to owned by the web server process. It's not enough to have the files be part of the www-data group, for example. Although technically AFAIK) So to enable web based updates, at least for the minute you press that button (hey, security! you might want to revert that after you've updated), do this

$ chown www-data:someuser . -R

within the directory of your WP install.

Leave a Reply

=