I host WordPress on AWS EC2 (Ubuntu) and encounter the following error while updating plugins:
To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.
rwx permission has been granted to the user www-data. Here is what I do.
<!– language: lang-bash –>
# Add a new group
groupadd www-pub
# Add the user `www-data` to the group 'www-pub'
usermod -a -G www-pub www-data
# Change the ownership of '/var/www/' to 'ubuntu:www-pub'
chown -R ubuntu:www-pub /var/www
# Change the permissions of all the folders to 2775
find /var/www -type d -exec chmod 2775 {} +
# Change the permissions of all the files to 0664
find /var/www -type f -exec chmod 0664 {} +
As you can see, www-data has all the right permissions, but I am still required to enter the FTP credentials. What is the reason and how can I fix it?
wordpressrequires to login in ftp with password but AWS EC2 provides me SSH-keys. I know that creating a password for ftp is a solution but I don't think this way is a good one. - SparkAndShinedefine('FS_METHOD', 'direct');to your wp-config.php file? - Demostheneswp-config.phpand it doesn't work. As @Corlax suggested, put it below the database information and now it works perfectly. - SparkAndShine