All Collections
Troubleshooting Server and Application
WordPress-related Issues
How to Resolve "WordPress Asking for FTP Credentials" Error
How to Resolve "WordPress Asking for FTP Credentials" Error

In this KB article, you will learn how to fix the error where WordPress asks for FTP credentials.

Cloudways Product avatar
Written by Cloudways Product
Updated over a week ago

Table of Contents

In this KB article, you will learn how to fix the error where WordPress asks for FTP credentials.

The error usually occurs when the following code is missing from wp-config.php file;

define('FS_METHOD','direct');

This function allows the current user to edit or install files in your folder. Here is how you can remedy this issue.

How to Resolve “WordPress Asking for FTP Credentials” Error

Here are a few steps to resolve this error.

Step #1

Now, you need to connect to your server remotely via SSH.

If you would like to know what is SSH and why it is used, then Click Here to find out. In this example, we are using Master Credentials to access the server remotely.

You can connect to your server via SSH in two ways, so choose your preferred option and click on that particular KB article to learn about connecting remotely to the server.

  1. Using SSH Client.

  2. Using the Cloudways Integrated SSH Terminal.

In this example, we are going to use a built-in Cloudways SSH terminal.

Log In the Cloudways Platform with your credentials. Click on Servers in the top menu bar. Then, click on your target server from the list.

Classic Interface

New Interface

This will now take you to the Server Management area.

Under the Server Management area, click on the Master Credentials section and then click on Launch SSH Terminal. It will open the shell box (SSH) within your browser in a new tab.

Classic Interface

New Interface

Important

A new tab will open, and you might see a security certificate warning as we are using self-signed certificates to protect the SSH connection. There is no need to worry. Just bypass this warning.

  1. Click on Advanced first.

  2. Now, click on Proceed to unsafe to accept the self-signed certificate.

Now, you will see this console screen, and then it will ask you for your login credentials. You can use Master Credentials or Application Credentials to login. Click Here to find out where your credentials are located.

Once done copying your credentials, go back to your SSH terminal window and paste your credentials, first username and then, the password.

Tip

To paste the credentials, first, right-click where the cursor is highlighted and click on Paste from browser, a new dialogue box will appear where you need to enter your username and press OK and then hit Enter.

Important

You will not see the password visible on the console screen due to security purposes.

If you managed to follow all the steps correctly, you should be logged in, and the terminal window will look as shown below:

Step #2

Now, you need to navigate to the public_html folder.

Important

Step 2 is for Master Users only; otherwise, if you are using Application Credentials, you can skip this step and jump to Step 3 directly.

Tip

If you are using the Master Credentials, you will need to browse to your target application folder. If you are using the Application Credentials, you will land directly in the public_html folder of the same application where the wp-config.php file is located, which we need to edit to fix this error.

First, type the below-mentioned command and hit enter to go to the applications folder.

cd applications


Now type this below-mentioned command and hit enter to list all the applications

ls -al

Tip

Your application name is the same as your Database name (DB name). Click Here to find out where your application name is located.

Now type this below-mentioned command and hit enter and the pattern is cd (Your Application Name). In this case, it is:

cd <application name here>

And now type this below-mentioned command and hit enter:

cd public_html

Step #3 — Launching a New Server

Now when you are in the public_html directory, type this below-mentioned command and hit enter to edit the wp-config.php file.

vim wp-config.php

Now, press i to start editing the file, and now using your arrow keys, navigate your cursor under MySQL settings.

Type the below-mentioned command above this line define(‘DB_NAME’, ‘*****’); and then press the ESC key. Please see the photo below for reference.

define('FS_METHOD','direct');

Here comes the final step of saving the changes, and for that, you need to press the ESC key, type the below-mentioned command, and hit enter.

:wq!

That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.


With Cloudways’ optimized configurations and proactive server management, you can get rid of errors for good. Choose our WordPress hosting server and experice a seamless managed hosting environment.

Did this answer your question?