Use and troubleshoot FTP
Inspect FTP with curl
Use curl verbose output and explicit TLS requirements to observe a transfer without relying on a graphical client.
8 minute lesson
curl can show the control conversation while handling data connections for you. Start with a server you own or are authorized to test.
curl --verbose --user "$FTP_USER" --ssl-reqd \
ftp://ftp.example.com/path/file.txt --output file.txt
--ssl-reqd refuses a cleartext FTP transfer. curl prompts for the password when it is omitted. For automation, use a protected credential file or secret store rather than shell history, scripts, logs, URLs, or command arguments.
Verbose output separates control lines:
< 220 FTP server ready
> AUTH TLS
< 234 AUTH TLS successful
> EPSV
< 229 Entering Extended Passive Mode (|||50021|)
> RETR path/file.txt
< 150 Opening data connection
< 226 Transfer complete
Lines beginning with > go to the server. Lines beginning with < came from it. TLS and connection diagnostics appear around them.
Use --ftp-pasv or the default passive behavior for ordinary networks. --ftp-port selects active mode and needs a reachable client endpoint. Do not change modes randomly; match the failure to the data connection direction.
For an upload, use --upload-file local.txt and a temporary remote URL. Check curl’s exit status and the FTP completion reply before a later rename or publication step.
Run a download with --verbose against an authorized server. Redact credentials and session identifiers, then annotate the greeting, TLS upgrade, data endpoint, preliminary reply, and completion reply.
Lesson completed