Skip to content

FTP "530 Login authentication failed" on cPanel: fixes

530 Login authentication failed means the FTP server rejected the login. Fix the usual cPanel causes, and the passive-mode hang that looks similar.

530 Login authentication failed means the FTP server rejected your username or password on the control channel, before a single file was touched. On cPanel the most common reason is the username form. An FTP account created under a domain is named user@example.com, and a client that quietly trims everything after the @ sends user, which the server does not recognize. The other usual causes are a suspended account, an FTP home directory that no longer exists, and an IP address banned after repeated failed logins. A second FTP fault looks similar in a support ticket but is a different problem: the client reports a successful login, then sits forever on Retrieving directory listing. That is not authentication. It is the passive-mode data connection, a second TCP connection on a high port that the firewall never allowed through. One look at the client’s protocol log tells you which of the two you have, and this article splits the same way.

What you’ll accomplish

  • Separate a 530 credential rejection from a passive-mode data-channel hang in a single reading of the client log.
  • Fix the four things that actually produce 530 on cPanel: the username form, a suspended account, an IP ban, and a missing FTP home directory.
  • Read a 227 Entering Passive Mode reply, decode the port it advertises, and test that exact port from the client machine.
  • Open the passive port range in CSF or firewalld and set the correct public address on a server behind NAT.
  • Recognize the FTPS case where the firewall’s connection-tracking helper cannot read the encrypted reply, and fix it without dropping encryption.

Prerequisites

Root or reseller access to WHM for the account checks, and root shell access for the daemon and firewall work. On the client side you want an FTP client that prints the protocol exchange — lftp -d, curl -v, or ftp -v -d all do. nc (netcat) on the client machine proves whether a specific port is reachable; flags differ between the OpenBSD and Nmap builds, so check nc -h if -z is rejected.

cPanel ships Pure-FTPd by default and can be switched to ProFTPD; the directive names differ and this article gives both. Firewall examples assume CSF, with firewalld shown where a server uses the stock RHEL firewall instead. Everything here applies to cPanel & WHM 110 and later. If the server sits behind a cloud load balancer or a NAT gateway, you also need access to that provider’s security-group rules — the host firewall is only half the path.

How it works

An FTP session uses two TCP connections, and almost every confusing FTP symptom comes from people not knowing that. The control connection is the one you think of as “FTP”: the client opens port 21, the server answers with a 220 banner, the client sends USER and PASS, and the server answers 230 Login successful or 530 Login authentication failed. Commands and replies travel here for the whole session. But no file data ever does. Every directory listing and every file transfer needs a data connection, which is a second, separate TCP connection opened for that one operation and then closed.

In the original design — active mode — the client names a callback port with a PORT command and the server opens the data connection inbound to the client. That stopped working the moment home and office networks went behind NAT and stateful firewalls: an unsolicited inbound connection to a client machine gets dropped, so the listing hangs. Passive mode inverts it. The client sends PASV, the server replies with an address and a high port, and the client opens the data connection outbound. Outbound is the direction firewalls allow, which is why passive is the default in every modern client — and why the burden moved to the server, where that high port range now has to be open inbound.

That inversion is the whole story. A 530 is a control-channel event with nothing to do with ports beyond 21. A hang after a successful login is a data-channel event with nothing to do with credentials.

Decision tree separating a 530 authentication failure from a passive-mode data channel hang, with the check command for each cause

Step-by-step

  1. Read the protocol exchange before you change anything. A GUI client’s status pane usually shows enough, but a command-line client is unambiguous. Run this from the machine that is failing, not from the server.

    lftp -d -u 'user@example.com' ftp.example.com

    Then, at the lftp prompt, force passive mode and ask for a listing:

    set ftp:passive-mode on
    ls

    A credential failure ends the conversation immediately:

    <--- 220 FTP Server ready.
    ---> USER user@example.com
    <--- 331 User user@example.com OK. Password required
    ---> PASS XXXX
    <--- 530 Login authentication failed

    A passive failure gets further and then stops:

    <--- 230 OK. Current restricted directory is /
    ---> PASV
    <--- 227 Entering Passive Mode (203,0,113,10,124,32)
    ---- Connecting data socket to (203.0.113.10) port 31776

    If the last line never resolves, you are in the passive half. Jump to step 5.

  2. Send the username the server actually knows. cPanel creates two kinds of FTP login. The main account login is the cPanel username itself — short, no domain, landing in the account’s home directory. Every FTP account created afterwards in cPanel » Files » FTP Accounts is named user@example.com, because one server hosts many domains and info alone would collide across accounts. The @domain suffix is the namespace, not decoration. Some clients and deployment scripts treat the @ as a separator and send only what precedes it, which is why the same password “works in FileZilla and fails in the CI job”. Confirm which logins exist:

    grep -o '^[^:]*' /etc/proftpd/USERNAME

    cPanel maintains that per-account file for whichever daemon is running, so it is the authoritative list of FTP logins for the account:

    user@example.com
    backup@example.com

    Type the full string into the client, including the domain. If a client mangles the @ and offers no escape, use a different client rather than guessing at substitutions.

  3. Rule out a suspended account and a missing home directory. A suspended cPanel account fails FTP with 530 even though the password is correct, and so does an FTP account whose target directory no longer exists — the daemon cannot chdir into the home after authenticating, so it refuses the login rather than dropping the user somewhere unexpected. That second case is the one that wastes the most time, because everything about it reads like a bad password.

    ls /var/cpanel/suspended/
    ls -ld /home/USERNAME/public_ftp /home/USERNAME/public_html

    A suspended account shows up as a file named after it; healthy directories print a normal listing:

    drwxr-xr-x 4 username nobody 4096 Sep  2 10:14 /home/username/public_ftp
    drwxr-x--- 9 username nobody 4096 Sep  4 08:31 /home/username/public_html

    If the directory an FTP account points at is gone, recreate it with the account’s ownership, or recreate the FTP account in cPanel so the path is rewritten.

  4. Check whether the source IP has been banned. Repeated failed logins from one address get that address blocked, and the symptom flips from “530 every time” to “the connection does not even open” — or stays at 530 if only the FTP service is blocked. On CSF servers, LFD tracks FTP login failures by default and drops the offender into the firewall.

    csf -g 203.0.113.10
    grep -i ftp /var/log/lfd.log | tail -20

    A ban is unmistakable in the output:

    DROP  all  --  203.0.113.10  0.0.0.0/0
    Temporary Blocks: IP:203.0.113.10 Port: Dir:in TTL:3600 (lfd - FTP login failures)

    Clear it and, for an operator address you trust, allow-list it so a retry loop cannot re-trigger the ban:

    csf -dr 203.0.113.10
    csf -a 203.0.113.10 office

    cPHulk is the other blocker to check. Its coverage depends on which services are enabled in WHM » Security Center » cPHulk Brute Force Protection, so read that page rather than assuming. Its history and the matching daemon messages:

    grep -i cphulk /var/log/messages | tail -20
    tail -50 /usr/local/cpanel/logs/login_log

    Clear a block from the History Reports tab of the same WHM interface, and add the address under Whitelist Management if it belongs to a fixed office or a deployment runner.

  5. Decode the passive reply. This is the step people skip, and it is the one that makes the rest obvious. The 227 reply encodes six comma-separated numbers: the first four are the IP address the client should connect to, and the last two are the port, as high byte and low byte. From the exchange in step 1, (203,0,113,10,124,32) means 203.0.113.10 on port 124 x 256 + 32, which is 31776. Some clients use EPSV instead and get a shorter reply that carries only a port:

    ---> EPSV
    <--- 229 Entering Extended Passive Mode (|||31776|)

    If the four-number address is a private range — 10.x, 172.16-31.x, or 192.168.x — the server is behind NAT and advertising an address the client cannot route to. If it is the correct public address, the problem is the port.

    FTP two-channel handshake showing the control connection on port 21, the PASV reply advertising a high port, and the point where the firewall blocks the data connection

  6. Test the advertised port from the client machine. Do this from the same network that is failing, because the answer is about that path and no other.

    nc -vz 203.0.113.10 31776

    A reachable port answers straight away:

    Connection to 203.0.113.10 31776 port [tcp/*] succeeded!

    A blocked one hangs until it times out, or is refused outright. While you are there, confirm the control port is answering and read the banner, which also tells you which daemon is running:

    telnet ftp.example.com 21
    Connected to ftp.example.com.
    220---------- Welcome to Pure-FTPd ----------
    220-You are user number 3 of 50 allowed.

    For more ways to interrogate a port from the client side, netcat port testing and transfers covers the flag differences between nc builds.

  7. Confirm the daemon’s passive range, then open it in the firewall. First find out which daemon is actually running — a server can have both installed and only one active:

    /usr/local/cpanel/scripts/restartsrv_ftpserver --status
    systemctl status pure-ftpd --no-pager
    pure-ftpd (/usr/sbin/pure-ftpd) is running as root with PID 1181 (systemd check method).

    Then read the configured range. Pure-FTPd keeps it in /etc/pure-ftpd.conf; ProFTPD uses PassivePorts in /etc/proftpd.conf:

    grep -i passiveportrange /etc/pure-ftpd.conf
    grep -i passiveports /etc/proftpd.conf
    PassivePortRange          49152 65534

    With no range set, the daemon picks arbitrary ephemeral ports and no firewall rule can cover them — set an explicit range first. Then add exactly that range to TCP_IN in /etc/csf/csf.conf and reload:

    grep '^TCP_IN' /etc/csf/csf.conf
    csf -r

    The range goes in as 49152:65534 alongside the existing ports. On a firewalld server instead of CSF:

    firewall-cmd --permanent --add-port=49152-65534/tcp
    firewall-cmd --reload
    success

    The same care applies to any port range on a cPanel box: the reasoning in closing MySQL port 3306 without breaking sites transfers directly — know who needs the port before you widen or narrow it.

  8. Set the public address on a server behind NAT. If step 5 showed a private IP in the 227 reply, the daemon is reporting the address on its own interface, which is correct from its point of view and useless to the client. Tell it what the world sees. Pure-FTPd uses ForcePassiveIP; ProFTPD uses MasqueradeAddress:

    grep -i forcepassiveip /etc/pure-ftpd.conf
    grep -i masqueradeaddress /etc/proftpd.conf

    Set it to the public address, restart the daemon, and re-read the reply:

    /usr/local/cpanel/scripts/restartsrv_ftpserver

    The next PASV should advertise the routable address:

    <--- 227 Entering Passive Mode (203,0,113,10,124,32)

    This is also the setting to change after a migration to a new IP; forgetting it is a classic post-migration FTP outage.

  9. Deal with the FTPS case. Firewalls have long papered over the passive problem with an FTP connection-tracking helper — nf_conntrack_ftp on Linux — which reads the plaintext 227 reply as it passes and opens the advertised port on the fly. That is why FTP sometimes works with no passive range configured at all. Enable FTPS and the control channel is TLS-encrypted, the helper sees ciphertext, and it can no longer learn the port. Everything else looks fine; the data connection simply never gets an opening. The fix is not to disable TLS — it is to stop relying on the helper: set an explicit PassivePortRange, open that range statically as in step 7, and set ForcePassiveIP as in step 8. Once the range is open by rule rather than by inspection, FTPS behaves like plain FTP. To confirm the helper is what you were depending on:

    lsmod | grep nf_conntrack_ftp

Validate it works

Run one non-interactive session that exercises both channels end to end. If this prints a listing, authentication and the data path are both healthy:

lftp -c "set ftp:passive-mode on; open -u 'user@example.com',PASSWORD ftp.example.com; ls; bye"
drwxr-x---   9 user  user  4096 Sep  4 08:31 public_html
drwxr-xr-x   4 user  user  4096 Sep  2 10:14 public_ftp

Then prove an actual transfer, since a listing is small enough to hide a marginal data path:

curl -v --ftp-pasv -T /tmp/test.txt ftp://ftp.example.com/ --user 'user@example.com:PASSWORD'
< 227 Entering Passive Mode (203,0,113,10,124,32)
< 150 Accepted data connection
< 226-File successfully transferred

Repeat both commands from a second network — a phone hotspot works — because a rule that only permits your office range passes here and fails for everyone else. Reference material: cPanel documentation for the FTP server configuration interfaces, and the Pure-FTPd project site for the directives.

Troubleshooting

It works from the office and fails from home. Per-source filtering, not a server fault. Check for an LFD or cPHulk block on the failing address first, then the client network’s own outbound rules — some corporate and hotel networks block outbound high ports, which kills passive mode from the client side.

One FTP account gets 530 while others on the same domain work. Credentials, not configuration. Reset the password from cPanel » Files » FTP Accounts and re-type it rather than pasting a saved entry. Characters clients handle badly are a real cause: a stray space at either end, or an unquoted $ or ! in a shell-invoked script. A password without them is a faster test than debugging the quoting.

Active mode works, passive hangs. Proof the passive range is not reachable. Active mode uses the server’s port 20 outbound, which nothing blocks. Do not settle for switching clients to active mode — it fails for every user behind NAT, which is most of them. Fix the range.

The first listing works, then later ones hang. The passive range is too small for the concurrent sessions. Each transfer holds a port through the TIME_WAIT interval, so a range of a few dozen ports on a busy server exhausts itself. Widen the range and the matching firewall rule.

The 227 reply shows the right public IP and nc still fails. The host firewall is not the only firewall. Cloud instances have a security group or network ACL in front of them, and opening the range in CSF changes nothing there. Add the same range to the provider’s inbound rules.

When this is the wrong approach

Plain FTP sends the username and password across the network in clear text. Anyone positioned to observe the traffic reads them, and on a shared network that is a realistic risk rather than a theoretical one. If you are choosing a file-access method rather than repairing one, choose SFTP over SSH. It runs over the single SSH connection on port 22, has no separate data channel, and therefore no passive port range, no masquerade address, and no connection-tracking helper to defeat — the entire second half of this article stops applying. On cPanel, SFTP needs shell access on the account, which is a deliberate decision rather than a default.

FTPS is the middle option: it keeps the FTP protocol and encrypts it, which satisfies requirements that name “encrypted file transfer”, but it inherits every passive-mode complication and adds the conntrack problem from step 9. Choose it when a client or vendor integration requires FTP specifically.

There is also a case for not running FTP at all. If file access is occasional, the cPanel File Manager and SFTP cover it without a public port 21 and without a wide inbound range on the firewall. Widening TCP_IN to make a hang go away, without knowing which range the daemon actually uses, is the opposite move and the one to avoid.

If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.