Menu Close

How to Stop WordPress Asking for FTP details to Upgrade Plugins


WordPress makes the experience of keeping plugins and the core installation an easy job and that goes a long way to making it one of the most popular Content Management Systems.

From the Admin Dashboard you can see how many updates there are and are given links to upgrade automatically.

WordPress 3.x even introduced the ability to upgrade everything all at the same time.

For most installations, this is all a seamless single-click operation.

So, why do some people get an additional form pop up asking for their ftp account details?

And more importantly, how do you make it go away – forever!

Here’s an explanation of why WordPress asks for this information and what you can do minimise or even stop typing your details in each time you perform an upgrade.

Or you can just jump to the quick fix and see if it works for you. Who cares how, right?

Why does WordPress ask for FTP Connection Information?

When automatically upgrading, installing or updating a plugin or the WordPress core from the Admin Dashboard, WordPress needs to make changes to the file system (your web hosted site).

Before making the changes, it first needs to check whether it has the correct permissions to do this.

If it doesn’t, you will be prompted to enter your FTP user account information (see image below) as your FTP user account will have the correct permissions to update the files on your website and WordPress can carry on using the FTP user.


Why can’t WordPress Update the File System?

Sounds a bit daft doesn’t it?

To understand what is happening here, we must understand how WordPress attempts to write files to the file system and that means poking around in the core files. Yay!

Whenever WordPress writes to the file system, it uses functions from the library wp-admin/includes/file.php specifically the get_filesystem_method() function.

if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
        if ( !$context )
            $context = WP_CONTENT_DIR;
        $context = trailingslashit($context);
        $temp_file_name = $context . 'temp-write-test-' . time();
        $temp_handle = @fopen($temp_file_name, 'w');
        if ( $temp_handle ) {
            if ( getmyuid() == @fileowner($temp_file_name) )
                $method = 'direct';

The code snippet above creates a temporary file and then checks to see if the file is owned by the same user that owns the currently running script.

Plugin installations will be running the script wp-admin/plugin-install.php.

It all depends on the way that your web host has setup WordPress to run in your environment.

In most cases, the web server (usually Apache) will be given ownership to run and update all WordPress installations, mostly by running under your user account.

Sometimes though, ISPs will run the web server under a system account that does not have direct ownership of your files.

In that circumstance you’ll get the FTP Connection Information form popping up.

How Can I Fix This?

There are a couple of ways to get rid of the FTP Connection Information form.

The first method will likely only work if you have your own dedicated or private server with root ssh access.

For 99.9% of shared hosting, you are unlikely to have the privileges required to muck around with the web server settings and that is what’s needed. If this is you, jump to the quick fix.

For this first method, we’re going to find out which user owns the web server and give that user ownership of your WordPress installation.

We’re assuming you’ve got a Linux box running Apache as the web server as that’s the most popular hosting plan type.

Login to your server box using ssh.

Find out what user is running the web server by typing:

ps aux | grep ‘apache’

The command will return something similar to this:

root@ubuntu-box:/# ps aux | grep ‘apache’
 root 1933 0.0 2.3 44900 12032 ? Ss Aug25 15:09 /usr/sbin/apache2 -k start
 webuser 2572 0.0 6.2 66468 30246 ? S Mar10 0:04 /usr/sbin/apache2 -k start
 webuser 6045 0.0 6.4 66884 31562 ? S Mar10 0:07 /usr/sbin/apache2 -k start
 webuser 6786 0.0 5.6 64156 27632 ? S Mar10 0:10 /usr/sbin/apache2 -k start

This tells you that the web server is running under the user webuser.

You can now give that user recursive ownership (all subfolders) of your WordPress installation using the command:

chown -hR webuser:webuser /var/

Replacing webuser with whatever user is running your Apache server and the last part with the direct path to your root WordPress installation folder.

Note: Some chown versions are different. Type chown –help to get info on your version.

The Quick Fix

Ok, so you’re on a typical shared hosting plan and just want this damned FTP Connection Information form to go away.

Here’s what to do.

Edit your wp-config.php file (found in the root of the WordPress installation) and add the following lines somewhere in between the start :

/** Setup FTP Details **/
define("FTP_HOST", "localhost");
define("FTP_USER", "your-ftp-username");
define("FTP_PASS", "your-ftp-password");

Replacing the values with whatever you use on the FTP Connection Information form.

Once saved and uploaded if making the changed from a local copy, you should no longer be prompted for FTP Connection Information.


Posted in News, Web Development


  1. bluehost review

    When I started building websites, I had no idea what I was doing.
    Google offers a Google Ad – Words promotional code often code website hosting companies, banks
    or other institutions, often with Web companies. Some people might be discouraged and drop out of blogging after a while.

  2. Lane

    Ola una mia cօllеga mi ha girato il link a questo blօg e sօno pasѕato a vedere se
    effettivamente merіta. Mi piace ampiamente. L’ho aggiunto tra i preferiti.
    Magnifico blog e template magnifico.

Leave a Reply

Your email address will not be published. Required fields are marked *