WordPress / Web Development Tutorials
(Best WordPress Tutorials)

Silva Web Designs - Blog

How to Fix The Error: WordPress Needs Access to Your Web Server

Have you ever seen the below warning when trying to update your WordPress Version or a WordPress Plugin?

This error will occur when file permissions and ownerships are not set correctly on your site’s server. This will then show the annoying popup that will force you to enter your FTP credentials each time you’d like to make a change to your site and its plugins.

Method 1

A super quick solution to the problem is adding the following to your functions.php file:

define( 'FS_METHOD', 'direct' );

This function allows the current user to edit or install files in your folder. Although this is a quick solution to the problem, we still advise on using Method 2 if you have SSH access to your server.

Method 2

The way to fix the error is to make sure our projects files and directories permissions are all set correctly.

In order to do this, we need to start by changing the ownership of your project (along with all the contents inside) so that it’s owned by the correct user on your web server. As an example, NGINX typically runs under the user www-data, while Apache typically runs under the user apache.

To change your project’s ownership, we need to connect to the server using SSH and then run one of the following commands:

NGINX Servers:

sudo chown www-data:www-data my-project -R

Apache Servers:

sudo chown apache:apache my-project -R

This alone may fix your issue, but if that is not the case, you’ll also need to ensure that your project has file permissions of 755, meaning that NGINX or Apache has the ability to write files to your server. You can ensure this is correct by using the following command:

NGINX and Apache Servers:

sudo chmod 755 my-project -R

Once your project’s ownership and permissions are set correctly the error should disappear which will allow you to install and update plugins as normal again.

What if I am running my site on a Shared Hosting Provider, e.g. GoDaddy, Bluehost, SiteGround?

If this is the case, then it’s unlikely that you’ll have the permissions to change the ownership of your directories. That being said, the issue most likely related to your project’s permissions, rather than the ownership.

Have a look through your hosting provider’s interface (e.g. cPanel/Plesk) to change the file permissions. If you manage to find the option then you can change your project and it’s content’s permissions to 755 and it should resolve the issue. If you are using an FTP client like FileZilla, then you can change them in here. Just make sure to set the value to 755 and recurse into the subdirectories; but only to directories only. Directories should always have 755 permission, whereas files should only have 644.

If that still doesn’t fix the issue, then we would recommend getting in touch with your hosting provider’s support team, they’re almost always able to help in such situations and typically get the job done rather quickly.

We hope that helps you overcome the error, if you need any help with this, feel free to get in touch or drop us a comment below!


Nathan da Silva - Profile

Posted by: Nathan da Silva

Nathan is the Founder of Silva Web Designs. He is passionate about web development, website design and basically anything digital-related. His main expertise is with WordPress and various other CMS frameworks. If you need responsive design, SEO, speed optimisation or anything else in the world of digital, you can contact Silva Web Designs here; [email protected]

It’s good to share

Join the discussion

Related Posts

Related - How To Fix “Unable to connect to the filesystem. Please confirm your credentials” In WordPress

Wordpress / 3rd January 2024

How To Fix “Unable to connect to the filesystem. Please confirm your credentials” In WordPress

Read More