How FTP works

Read FTP reply codes

Use the three digits in an FTP reply to understand completion, connection, authentication, and filesystem results.

Every FTP reply starts with three digits, then text. Learn the first digit and half the confusion goes away.

1xx means the operation started and another reply is coming. 2xx means success. 3xx needs more input from you. 4xx is temporary failure. 5xx is permanent for that request.

The second digit groups the subject. 150 opens a data transfer. 226 confirms it finished. That pair shows up on almost every download. When a transfer feels stuck, I look for whether 150 arrived and whether 226 ever did.

If you only log the last line, you miss failures that started with an optimistic preliminary reply.

Upload a file and read what comes back:

ftp> put release.zip.part
150 File status okay; opening data connection
226 Transfer complete

Now pretend the disk is full:

ftp> put release.zip.part
150 File status okay; opening data connection
452 Insufficient storage space

The 150 did not promise success. The final 452 says the upload failed after bytes started moving. Keep your local file. Do not rename the remote .part file into place.

You will see these often: 220 at connect, 331 before the password, 425 when the data connection cannot open, 530 for bad login, and 550 when a file action is unavailable.

Multiline replies repeat the same code with a hyphen until the last line uses a space:

211-Features:
 MLSD
 SIZE
211 End

Read through the terminator before you act on a long FEAT response.

If you see 421, the server is closing the session. Open a new connection instead of sending more commands on a dead control channel.

When something fails, write down the command, the numeric reply, and whether a data connection opened. That beats saying “upload failed” in a ticket.

Lesson completed