FTP reply code 502 means the server knows the command but has chosen not to implement or has disabled it. This is different from 500 (unrecognized command) — the server understands what was asked but refuses to perform it. Common targets include SITE commands (server-specific operations), ACCT (account selection), MODE (transfer mode beyond stream), STRU (file structure beyond file), and some security-related commands. The command will never work on this server regardless of how many times you retry it.
The client sent a SITE command (e.g., SITE CHMOD, SITE EXEC) that this server does not implement. SITE commands are vendor-specific — what works on vsftpd may not work on ProFTPD or IIS FTP.
Commands like ACCT, MODE, STRU, SMNT, and REIN are defined in RFC 959 but rarely implemented by modern servers. Sending these commands results in 502.
The client sent an FTP extension command (MLST, MLSD, HASH, etc.) that this server does not support. Check the FEAT response to see which extensions are available.
Send FEAT to see which extensions the server supports. Send HELP to see all available commands. Only use commands the server explicitly supports.
curl -v ftp://ftp.example.com/ -Q 'FEAT'
If a specific command is not implemented, use the standard alternative. For example, if MLSD is not available, use LIST. If SITE CHMOD is not available, change permissions through SSH or a control panel.
Unlike 4xx errors, 502 is permanent. The server will never support this command. Find an alternative approach or use a different method to accomplish the task.