Skip to content

Locking down FTP at the cPanel account level

How to disable FTP entirely on a cPanel account while keeping the rest of the panel functional, plus the WHM-wide options that prevent it from being re-enabled by accident.

Plain FTP on a per-account basis is rarely turned off when an account is migrated to SFTP — the account works, no one notices the open door. Six months later a credential leaks and the access log shows a successful FTP login from an IP nobody recognizes. Disable FTP on accounts that don’t need it; the work is small.

What’s happening

Pure-FTPD on cPanel authenticates against the cPanel user database and against per-account sub-FTP accounts stored in /etc/proftpd/<user> (despite the name, this is pure-ftpd data on most cPanel installs). Disabling FTP for an account means removing the main account’s ability to log in by FTP and removing all sub-FTP entries, while leaving the cPanel user, mail accounts, and SFTP path alone.

How to verify

Identify what is currently allowed:

cat /etc/proftpd/<user>
whmapi1 list_ftpsessions
last -i | grep -i ftp
grep <user> /var/log/xferlog | tail

The first command shows the sub-FTP account database for the cPanel user. xferlog tells you whether anyone has actually used FTP recently — if it has been silent for 90 days, there is no production load to migrate.

The fix

  1. Remove sub-FTP accounts via WHM > Manage FTP or whmapi1 deleteftp per entry. Keep a copy of the list — you may need to recreate them as SFTP users.
  2. Disable the main account’s FTP password by setting an impossible password in /etc/proftpd/<user> — the supported approach is via cPanel API: uapi --user=<user> Ftp passwd password=$(openssl rand -base64 32). Don’t share the new password.
  3. Communicate the switch — clients who were FTP-uploading site assets need SFTP credentials and an updated client config. Send a one-pager with FileZilla/Cyberduck SFTP setup steps.
  4. At the server level, narrow PassiveIP and PassivePortRange in /etc/pure-ftpd.conf, and consider raising the FTP listening port from 21 to 2121 if no one legitimately needs port 21 — the bots scan 21, not 2121.
  5. Audit quarterly: whmapi1 list_users cross-referenced with sub-FTP databases. New accounts created later may re-introduce FTP — catch that drift early.

Stack Harbor includes FTP lockdown audits in every cPanel/WHM management engagement.