Issue with FTP in cPanel

October 18, 2015

I was having an issue with all users accessing their ftp accounts on my cpanel web server. It had worked previously however it seemed to change suddenly, preventing users accessing their files. This also prevented the root user accessing the server via ftp.

cPanel FTP Issue

When trying to connect using filezilla, I was getting connected to the web server however the directories were not listing, I was getting the following error: ‘ the data connection could not be established: ECONNREFUSED – Connection refused by server ‘. I could see I was establishing a connection to the web server because I could see the user listed under FTP Connections in the clients cPanel control panel.

To fix the issue with listing the directory with my FTP client I connected to my web server via ssh and logged in as the sudo user, I used the root account. Once logged in I ran the following command: ‘ /sbin/iptables -F ‘,This command flushes the iptables on the server.

Once the command was run I was able to connect once again to the server via FTP.

WordPress – Prompting For FTP Details

May 30, 2015

I host multiple websites on my own linux web server, all these sites run WordPress and on occasion I get prompted for FTP credentials when trying to update plugins or when I try to do a quick edit using WordPress’ built in theme editor.

Below is an example of WordPress requesting FTP credentials;

WordPress Requesting FTP Credentials

The reason this is presented to you is due to permission on the directories on your web server. Below is a command that you can run from the command line that will change the ownership of all files and folders within the folder you specify. In this example it will modify all files and folders in the public_html folder that I have specified. Run this command on the directory where your WordPress install is located.

chown -R www-data:www-data /var/hostdata/

Once you have run this command, reload the page that was prompting for FTP credentials and it should work as normal.