June 29, 2022 | Posted in AWS, WordPress
For installation of the theme and plugins on AWS EC2, we can skip the FTP credentials. I came to know this recently.
I recently installed a WordPress site on AWS EC2 and found I can not install any theme or plugin. Each time I tried to install a plugin or theme, WordPress showed me a pop form on which it required an FTP credential.
I have researched on the web how to create an FTP client for EC2. So I followed a tutorial and created an FTP client AWS EC2. But it didn’t work.
According to the tutorial, I had install vsftp and configured the /ec/vsftpd/vsftpd.conf
The tutorial instructed to change a line on vsftpd.conf file
anonymous_enable=YES
To
anonymous_enable=NO
And Add the following lines of code :
pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=[YOURPUBLICIP]
Unfortunately, all of my efforts failed. I couldn’t able to solve the FTP credentials problem.
Fortunately, I found a solution in stackoverflow, and the person had the same problem as mine.
The answer is mindblowing; add one line of code on the wp-config.php file.
Here is the solution for skipping the FTP credential on AWS EC2. Add the following line on your wp-config.php located in the WordPress root directory.
define('FS_METHOD', 'direct');
Also, you may need to assign write permission to the WordPress directory. To do that, we need to enter the below command into the terminal to set the write permission.
sudo chown -R apache:apache /var/www/html
Assume the WordPress folder is on html directory.
I hope this instruction helps you skip the FTP credential on AWS EC2.