FTP 协议命令实战

FTP 协议命令实战
废话就不多说了,下面是用TELNET连接Serv-U测试成功的例子

下载文件
---------------------------------------------------------------------------
TELNET 127.0.0.1 21
220 Serv-U FTP Server v4.0 for WinSock ready...

USER ADMIN
331 User name okay, need password.

PASS ****
230 User logged in, proceed.

PASV
227 Entering Passive Mode <127,0,0,1,4,191>

REST 0
350 Restarting at 0. Send STORE or RETRIEVE.

RETR test.rar
150 Opening ASCII mode data connection for test.rar <94370 bytes>.
226 Transfer complete.

覆盖方式上传文件
---------------------------------------------------------------------------
TELNET 127.0.0.1 21
220 Serv-U FTP Server v4.0 for WinSock ready...

USER ADMIN
331 User name okay, need password.

PASS ****
230 User logged in, proceed.

STOR test.dat
150 Opening ASCII mode data connection for test.dat

PASV
227 Entering Passive Mode <127,0,0,1,4,191>

...创建另一条连接到指定端口然后向其发送数据...

追加方式上传文件
---------------------------------------------------------------------------
TELNET 127.0.0.1 21
220 Serv-U FTP Server v4.0 for WinSock ready...

USER ADMIN
331 User name okay, need password.

PASS ****
230 User logged in, proceed.

APPE test.dat
150 Opening ASCII mode data connection for test.dat

PASV
227 Entering Passive Mode <127,0,0,1,4,191>

...创建另一条连接到指定端口然后向其发送数据...

重命名文件和目录
---------------------------------------------------------------------------
TELNET 127.0.0.1 21
220 Serv-U FTP Server v4.0 for WinSock ready...

USER ADMIN
331 User name okay, need password.

PASS ****
230 User logged in, proceed.

RNFR sss.rar
350 File or directory exists; ready for destination name

RNTO stock.rar
250 RNTO command successfull.

删除文件
---------------------------------------------------------------------------
TELNET 127.0.0.1 21
220 Serv-U FTP Server v4.0 for WinSock ready...

USER ADMIN
331 User name okay, need password.

PASS ****
230 User logged in, proceed.

DELE test.dat
250 DELE command successfull.

建立和删除目录
---------------------------------------------------------------------------
TELNET 127.0.0.1 21
220 Serv-U FTP Server v4.0 for WinSock ready...

USER ADMIN
331 User name okay, need password.

PASS ****
230 User logged in, proceed.

MKD myDir
257 "/myDir" directory created.

RMD myDir
250 RMD command successfull.

退出连接
---------------------------------------------------------------------------
TELNET 127.0.0.1 21
220 Serv-U FTP Server v4.0 for WinSock ready...

USER ADMIN
331 User name okay, need password.

PASS ****
230 User logged in, proceed.

QUIT
221 Goodbye!

你可能感兴趣的:(ftp)