221: Service Closing Control ConnectionFTP reply code 221 is sent by the server after the client issues a QUIT command, confirming the session is ending and the control connection will be closed. This is the normal, graceful end of an FTP session. After 221, the TCP connection on port 21 is terminated. If the server sends 221 without the client sending QUIT, it may be enforcing an idle timeout or shutting down. Any active data transfers should be completed before QUIT is issued — sending QUIT during an active transfer may result in incomplete files.
221 Service Closing Control Connection220 ftp.example.com FTP server ready
USER alice
331 Password required
PASS ****
230 User alice logged in
QUIT
221 GoodbyeIf the connection closed unexpectedly, check your FTP client logs to see if QUIT was sent. If not, the server may have timed out the connection due to inactivity.
If your FTP client is idle for long periods, send NOOP commands periodically to keep the connection alive. Most FTP clients have a keep-alive setting that does this automatically.
Ensure all data transfers are complete (you have received 226) before sending QUIT. Disconnecting during an active transfer may corrupt the file.
The client sent QUIT after completing all file transfers and the server acknowledged with 221. This is the expected end of every FTP session. The client should close its end of the TCP connection after receiving this response.
FTP servers enforce idle timeouts (typically 60-300 seconds). If the client does not send any commands within the timeout period, the server sends 221 and disconnects. This is normal behavior to free up server resources.
During a graceful server shutdown, the FTP daemon sends 221 to all connected clients before stopping. This allows clients to cleanly close their connections.
The FTP server is ready and accepting connections. This is the greeting banner sent upon connection.
The file transfer completed successfully and the data connection is being closed.
The FTP server is unavailable and is closing the connection. The client should retry later.
| Specification | Section |
|---|---|
| RFC 959 | RFC 959 §4.2 |
This reference was compiled from official RFCs, protocol specifications, and hands-on troubleshooting experience. AI tools were used primarily for formatting and organizing the content on the page.