If you’re trying to install or update a plugin or theme and WordPress suddenly requires FTP or SFTP credentials, you’re dealing with an issue that tells you WordPress isn’t able to directly write to your file system. Because of the rise of managed hosting setups, this is a fairly common issue and seems to happen with higher frequency after a migration.
You may see something that looks like this:

At first glance it seems like a permissions issue – in most cases it is. However, there are several different paths to resolve the issue, depending on how many restrictions you have tied into your hosting plan and how much access you have as an owner or administrator in your install.
In this Blog Guide, we will quickly review five quick methods to prevent WordPress from always asking for FTP credentials, and begin updating and installing normally again.
Why Does WordPress Ask for FTP Credentials?
When WordPress updates plugins, themes, or itself, it needs to write files to your server. On most hosting setups, it tries to use PHP’s file system functions directly. But when:
- File permissions are too limited or restricted.
- The web server user doesn’t have ownership of the files
- PHP can’t write to the wp-content directory
- The hosting environment is locked down
WordPress can’t proceed. As a fallback, it asks for FTP or SFTP credentials so it can transfer the files using an external method instead. That’s why this issue is less about missing features, and more about server configuration and file access.
5 Easy Methods to Fix WordPress Asking for FTP Credentials
We have gathered 5 quick methods for you to fix the WordPress asking for FTP Credentials. You can follow these steps to get rid of this error to proceed. Let’s get started!
Method 1: Force Direct File Access in wp-config.php
The quickest fix is to tell WordPress to use the “direct” method explicitly — this means using PHP’s native file handling to make changes, skipping FTP altogether. To do this, open your site’s wp-config.php file (located in the root directory of your WordPress installation) and add the following line:
define('FS_METHOD', 'direct');
Make sure you add it above this line:
/* That's all, stop editing! Happy blogging. */

This instructs WordPress to skip the FTP fallback and just attempt direct file access. Most of the time, this is all you need.
Optionally, you can also define the recommended permissions:
define('FS_CHMOD_DIR', 0755);
define('FS_CHMOD_FILE', 0644);
These aren’t always necessary, but help reinforce the correct permissions during file writes.
Method 2: Fix File and Folder Permissions
If method 1 didn’t do the trick, it may be because WordPress still doesn’t have the right to modify files. That’s where proper file and folder permissions come in.
Here’s what you want:
- Folders: 755
- Files: 644
You can change these via command line (SSH) like this, do make sure your path is correct:
find /path/to/your/site -type d -exec chmod 755 {} \;
find /path/to/your/site -type f -exec chmod 644 {} \;
If you’re using a file manager (like in cPanel or Plesk), you can manually check and adjust these.
As you see, ownership matters too. Permissions are just part of the story. File ownership should also align with the user account used by your web server. Even the best permissions will be useless if they do not match.
You can use this command to change ownership:
chown -R www-data:www-data /path/to/your/site
💡Note: Substitute www-data with your actual web server user, and don’t forget sudo if needed.
Method 3: Add FTP Details in wp-config.php
If you’re on shared hosting or a provider that requires FTP for file changes, you can simply tell WordPress what to use so it stops asking every time. In your wp-config.php, add:
define('FTP_USER', 'your_ftp_username');
define('FTP_PASS', 'your_ftp_password');
define('FTP_HOST', 'ftp.yoursite.com');
This will let WordPress automatically use your login credentials whenever needed. Make sure the host name matches what your provider expects, sometimes it’s localhost, sometimes it’s your domain or a specific IP.
💡Tip: For security, make sure your wp-config.php file isn’t world-readable, and use strong FTP passwords.
Method 4: Try Alternative File Access Methods (ftpext, ftpsockets, ssh2)
Besides direct, WordPress supports other file access methods. You can specify them using the FS_METHOD constant:
define('FS_METHOD', 'ftpext');
Or:
define('FS_METHOD', 'ftpsockets');
These tell WordPress to use the built-in PHP FTP extension or raw socket connections. They’re useful if direct isn’t working and you prefer not to hardcode credentials.
For SFTP (using SSH keys), you can also define:
define('FS_METHOD', 'ssh2');
define('FTP_USER', 'your_ssh_user');
define('FTP_PUBKEY', '/home/user/.ssh/id_rsa.pub');
define('FTP_PRIKEY', '/home/user/.ssh/id_rsa');
💡Note: This requires the ssh2 PHP extension to be installed and your keys to be properly configured.
Method 5: Let Your Host Handle It
Sometimes, nothing you change manually will work, especially if your hosting environment is tightly secured or runs PHP under a different user than the one owning your WordPress files.
In this case, your best option is to contact your hosting provider. They may need to:
- Adjust file ownership to match the web server process
- Switch PHP to run under your user (using FastCGI or suPHP)
- Install missing PHP extensions like php-ftp or php-ssh2
If you’re using Cloudways, this is rarely an issue unless the file permissions have been manually changed. In that case, just set FS_METHOD to ‘direct’ and ensure ownership is restored using SSH as the master user.
Conclusion
When you see that WordPress requests FTP credentials, it is not an error, it’s just a fallback. It means that WordPress attempted to update your files but was unsuccessful. Usually it comes down to permission issues, ownership issues, or restrictive hosting environments.
Fortunately, getting this fixed is typically easy. You can set it to allow direct access, correct permissions so ownership is correct, provide credentials, or make sure your host handles it. Once configured correctly, WordPress will never ask for FTP again, and your site will update themes, plugins, and the core in one click.
If you take it one step at a time, you will have your site working again with no FTP and no issues. With Cloudways WordPress Managed Hosting, you won’t have to deal with such issues at all.
Frequently Asked Questions
1. Is it safe to add FTP credentials to wp-config.php?
Yes, as long as your hosting is secure and wp-config.php isn’t publicly accessible. Still, use strong passwords and avoid this method if you can fix the issue using file permissions or the direct method.
2. What are the right permissions for WordPress?
Folders should be set to 755, and files to 644, and the owner of the files should be the same user as the web server’s user (e.g., www-data, or apache). Just don’t set anything to 777, that is bad for security.
3. Why doesn’t FS_METHOD ‘direct’ work even after I added it?
If the user for the webserver doesn’t own the files or folders or isn’t granted write access, WordPress will still be unable to use direct mode. Be diligent in checking ownership and permissions.
4. Do I always need FTP to update WordPress?
No! Ideally, WordPress should update itself without FTP using the “direct” method. FTP is only needed when direct access isn’t available or allowed by your host.
Salwa Mujtaba
Salwa Mujtaba is a Technical Content Writer at Cloudways. With a strong background in Computer Science and prior experience as a team lead in Cloudways Operations, she brings a deep understanding of the Cloudways Platform to her writing. Salwa creates content that simplifies complex concepts, making them accessible and engaging for readers. When she's not writing, you can find her enjoying good music, reading a book, or spending quality time with her family.