This often happens after moving your site, restoring a backup, or deploying through Docker or a hosting control panel. When the file ownership or permissions don’t match what WordPress expects, it can’t write directly and falls back to asking for FTP details.
While this is happening you might notice that if you try to update an existing plugin you could see a message about how the plugin update has failed.

The Root of the Problem
WordPress normally writes directly to the filesystem using the same user that runs your web server (for example, www-data
on Debian and Ubuntu). If some of your files or folders are owned by root
or another user, WordPress can’t update them.
You can check ownership by running this inside your WordPress directory:
ls -lah
If you see root
listed as the owner of directories like wp-admin
, wp-includes
, or wp-config.php
, that’s your culprit.
Fixing Ownership and Permissions
The easiest fix is to reset ownership and permissions so WordPress can manage its own files safely.
sudo chown -R www-data:www-data /var/www/your-site
sudo find /var/www/your-site -type d -exec chmod 755 {} \;
sudo find /var/www/your-site -type f -exec chmod 644 {} \;
If your WordPress files are inside a Docker volume, just replace /var/www/your-site
with your actual volume path.
Tell WordPress to Use Direct File Access
Even after fixing ownership, it’s good practice to tell WordPress explicitly to use direct access. Edit your wp-config.php
file and add this line above the “That’s all, stop editing!” comment:
define('FS_METHOD', 'direct');
This tells WordPress to skip FTP entirely and write straight to the filesystem.
You don’t need to restart anything for this change to take effect. Just try updating a plugin or theme again — the FTP credentials prompt should disappear and WordPress will handle the update directly.
To confirm your WordPress file permissions are correctly set, try installing a harmless plugin such as Hello Dolly. You can do this by going to Plugins → Add New in your WordPress dashboard, searching for “Hello Dolly,” and clicking Install Now followed by Activate.

This plugin is safe to use because it only displays random song lyrics in the admin area and doesn’t alter your site’s functionality. It's main purpose is usually for testing such as we are doing now.
If the installation completes without WordPress asking for FTP login details, that means your server permissions and configuration are now correct and WordPress can directly write to the filesystem as intended.
If the issue returns later, double-check that your hosting environment or Docker container isn’t resetting permissions on restart.