Recently I have launched an EC2 instance with WHM-cPanel. I have associated 5 EIP to the instance and assigned them for 5 different site in WHM panel. Sites are running good but connecting via FTP failed for secondary sites. I can connect in main site by domain or IP as hostname, but for all other sites, FileZilla is first able to logged in and then tries to connect with passive mode with response like

227 Entering Passive Mode (xx,xxx,xxx,xxx,214,117)

where xx,xxx,xxx,xxx is my main site EIP and finally fails to show directory lists with response

Error: The data connection could not be established: ECONNREFUSED - Connection refused by server
Error: Connection timed out after 20 seconds of inactivity
Error: Failed to retrieve directory listing'.

I have opened port range 49152-65535 from security groups rule but that doesn't work too.

Can anyone please help me to solve this issue?

  • 1
    Why are you using FTP? Consider using SFTP and you won't have problems like this. – Martin Prikryl Oct 1 at 14:14
  • @MartinPrikryl For some reason, i need just ftp access to send to my client to send me files there. – Zakir Hossain Oct 1 at 20:46

Finally I were able to solve the problem as cPanel documentation here https://documentation.cpanel.net/display/CKB/How+to+Enable+FTP+Passive+Mode#c18e0c81d1de428dae2e490af081df89

And for me the last paragraph 'Troubleshoot FTP passive mode' was important where it says:

If your NAT-configured server cannot execute Passive FTP connections to other IP addresses on the server, perform either of the following actions:

  1. In cPanel & WHM version 66 and later, set the ForcePassiveIP option with a tilde (~) character. The system interprets this character as an undefined directive and prevents automatic changes to the /etc/pure-ftpd.conf or /etc/proftpd.conf files..."

So I had to edit file /var/cpanel/conf/pureftpd/local with text

ForcePassiveIP: ~
PassivePortRange: 49152 65534

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.