Skip to content

FTP Protocol

File Transfer Protocol(文件传输协议)

client/server model

  • client: initiates transfer(to/from remote)
  • server: remote host
    • maintains "state": current directory, earlier authentication, stateful

transport protocol - TCP
FTP - RFC 959 Port - 21

Two parallel TCP connections

  • Control: exchange commands, responses between client and server (out of band control)
  • Data: file data to/from server
commandparameterusage
USERusername
PASSpassword
LISTreturn list of file in current directory
RETRfilenameretrieves(gets) file
STORfilenamestores(puts) file onto remote host
status codeintroduction
331Username OK, password required
125data connection already open, transfer starting
425can’t open data connection
452error writing file