WordPress on EC2 Requires FTP Credentials to Install Plugins

The main issue here is that apache does not have access to the folders. The default permission is given to the ec2-user in the AMI.

run this in your terminal and you should be good to go.

sudo chown -R apache:apache /var/www/html

Once this is done you should be able to upload themes, plugins, updates etc.


Try this code in your wp config file

define('FS_METHOD', 'direct');

change owner of wordpress directory

sudo chown -R www-data:www-data /var/www/wordpress

OR try

define('FS_METHOD', 'direct');

This worked for me:

First follow what Faizan said to do and put the following line if your wp-config.php:

# you will want this as close to the bottom as possible
define('FS_METHOD', 'direct');

Then you need to TEMPORARILY swap your file permissions to a more open state. In the command line type the following:

sudo chmod 777 -R /your_whole_wp_project

Now run your updates and then change the permissions back to something sane like:

sudo chmod 664 -R /your_whole_wp_project

I'm aware this is a security issue and maybe not the best way to do this, but its the only thing I could try that got it to work for me.


I found the answer to this question at Stephen White's blog post.

In a nutshell, I have to

  • create custom rules for Port Ranges 20-21 and some additional ports in my EC2 instance FW
  • install and configure the FTP server vsftpd
  • create and configure an FTP user
  • and put my FTP setting in the wp-config.php file

    This works very well for me now.