You are on page 1of 6

Tm hiu v FTP

1. Gii thiu FTP l ch vit tc ca File Transfer Protocol - Giao thc truyn file. FTP l mt giao thc truyn file trn mng da trn chun TCP nn rt ng tin cy! 2. Mt s lnh ph bin ca FTP Sau y l danh sch mt s lnh thng dng km theo hng dn m bn cn bit! ascii chuyn sang ch truyn file theo dng vn bn binary chuyn sang ch truyn file theo dng nh phn cd [directory] chuyn vo th mc directory cdup chuyn ln th mc cp trn mt cp close ngt kt ni vi my ch del [remote-file] xa 1 file trn my ch dir [remote-directory|file] lit k ni dung ca th mc hoc danh sch cc file trn my ch help [command] cho bit hng dn v lnh command lcd [local-directory] t li th mc lm vic trn client l localdirectory ls [remote-directory|file] [-la] lit k ni dung ca th mc hoc danh sch cc file trn my ch; tham s -la s lit k tt c c km theo m t v quyn mdelete [remote-files] xa nhiu file trn my ch mget [remote-files] download cc files trn my ch v mkdir <directory-name> to th mc c tn directory-name

mput [local-files] upload cc files ln my ch open host [port] kt ni n my ch FTP c hostname l host v ang chy dch v FTP cng port put <local-file> [remote-file] upload local-file ln my ch vi tn mi l remote-file nu c pwd cho bit th mc ang lm vic hin thi quit thot recv <remote-file> [local-file] nhn remote-file trn my ch v lu trn my tnh vi tn local-file nu c rename [from] [to] i tn file hoc th mc from thnh to rmdir directory-name xa th mc c tn directory-name send local-file [remote-file] gi local-file t my tnh ln my ch vi tn mi l remote-file nu c status cho bit trng thi ca phin lm vic hin ti system cho bit h iu hnh ca my ch user user-name [password] [account] login vo vi tn l user-name, mt khu l password, ti khon l account ? gi hng dn 3. Cc v d d hiu, cc bn hy xem cc v d sau:(ti s dng cc ny upload my file ln website , khng cn dng cc chng trnh FTP mnh nh WS_FTP Pro, FTPNet, CuteFTP, AbsoluteFTP, ...!) Ti lu trang web cn ti ln server trong c:\website! By gi ti s ti n ln! C:\website>ftp myftpsrv // kt ni n my ch myftpsrv Connected to myftpsrv. User (ftpsrv:(none)): dt 331 User name okay, need password. Password: 230 User logged in, proceed. ftp> pwd // cho bit th mc hin ti ang lm vic! 257 "/home/dt" is current directory. ftp> status // xem trng thi hin ti Type: ascii; Verbose: On ; Bell: Off ; Prompting: On ; Globbing: On 2

Debugging: Off ; Hash mark printing: Off . // ascii=1 ftp> cd www // chuyn vo th mc www 250 Directory changed to /home/dt/www ftp> put index.html // upload file index.html ln server 200 PORT Command successful. 150 Opening ASCII mode data connection for index.html. 226 Transfer complete. ftp: 2095 bytes sent in 0.00Seconds 2095000.00Kbytes/sec. ftp> mkdir tools // to th mc /home/dt/www/tools 257 "/home/dt/www/tools" directory created. ftp> cd tools // chuyn vo th mc tools 250 Directory changed to /home/dt/www/tools ftp> lcd c:\website\tools // thay i li local directory = c:\website\tools Local directory now C:\website\tools. ftp> bin // chuyn sang ch truyn file nh phn 200 Type set to I. ftp> mput *.* // upload tt c cc file trong c:\website\tools ln server, vo /home/www/tools/ mput test.zip? y 200 PORT Command successful. 150 Opening BINARY mode data connection for test.zip. 226 Transfer complete. ftp: 10168 bytes sent in 0.06Seconds 169.47Kbytes/sec. mput test.exe? y 200 PORT Command successful. 150 Opening BINARY mode data connection for test.exe. 226 Transfer complete. ftp: 54625 bytes sent in 0.11Seconds 496.59Kbytes/sec. ftp> ls -la // lit k ni dung ca /home/www/tools 200 PORT Command successful. 150 Opening ASCII mode data connection for /bin/ls. drwxr--r-1 dt group 0 Sep 30 14:13 . drwxr--r-1 dt group 0 Sep 30 14:13 .. -rwxr--r-1 dt group 54625 Sep 30 14:14 test.exe -rwxr--r-1 dt group 10168 Sep 30 14:14 test.zip 226 Transfer complete. ftp: 247 bytes received in 0.00Seconds 247000.00Kbytes/sec. ftp> del test.exe // ti l tay upload ln file test.exe, by gi ti cn phi xa n 250 DELE command successful. ftp> cd .. // chuyn ln th mc cp trn 250 Directory changed to /home/dt/www ftp> mkdir cgi-bin2 // to th mc mi 257 "/home/dt/www/cgi-bin2" directory created.

ftp> rename cgi-bin2 cgi-bin // ti nhp vo sai mt ri, by gi phi i tn li thi! 350 File or directory exists, ready for destination name 250 RNTO command successful. ftp> cd cgi-bin // chuyn vo th mc cgi-bin 250 Directory changed to /home/dt/www/cgi-bin ftp> lcd c:\website\cgi-bin // t li local directory! Local directory now C:\website\cgi-bin. ftp> ascii // chuyn sang ch truyn file vn bn v ti cn upload mt s file .cgi + .pl 200 Type set to A. ftp> put test.cgi // upload file test.cgi 200 PORT Command successful. 150 Opening ASCII mode data connection for test.cgi. 226 Transfer complete. ftp: 222 bytes sent in 0.00Seconds 222000.00Kbytes/sec. ftp> ls -la // xem ni dung ca /home/www/cgi-bin 200 PORT Command successful. 150 Opening ASCII mode data connection for /bin/ls. drwxr--r-1 dt group 0 Sep 30 14:16 . drwxr--r-1 dt group 0 Sep 30 14:16 .. -rwxr--r-1 dt group 222 Sep 30 14:17 test.cgi 226 Transfer complete. ftp: 182 bytes received in 0.00Seconds 182000.00Kbytes/sec. ftp> site chmod 755 test.cgi // t quyn 755(wrxx-xr-x) cho file test.cgi ftp> ls -la // ti lit k li th mc cgi mt ln na 200 PORT Command successful. 150 Opening ASCII mode data connection for /bin/ls. drwxr-xr-x 1 dt group 0 Sep 30 14:16 . drwxr-xr-x 1 dt group 0 Sep 30 14:16 .. -rwxr-xr-x 1 dt group 222 Sep 30 14:17 test.cgi 226 Transfer complete. ftp: 182 bytes received in 0.00Seconds 182000.00Kbytes/sec. ftp> bye // tt c xong, by gi ti c th ngt kt ni c ri! 221 Goodbye! C:\website> Hi vng l bn hiu c v d trn!

4. Ni thm v FTP Lm th no kt ni vi mt my ch FTP qua mt proxy-server, chng hn nh Wingate? Ch cn ftp n proxy-server ny v g vo nh dng sau, user@host[:port]. V d my ti ang chy Wingate-FTP cng 21 v Serv-U FTP-Server v2.5i cng 2121, ti c th kt ni n Serv-U FTP-Server v2.5i qua Wingate-FTP nh sau: C:\>ftp localhost Connected to dt. 220 WinGate Engine FTP Gateway ready User (dt:(none)): dt@localhost:2121 331 User name okay, need password. Password: 230 User logged in, proceed. ftp> Okay, by gi ti upload v download file nh bnh thng c ri! 5. Hack vi FTP i khi FTP cng cho bit mt s thng tin rt quan trng! Bn d dng on c h iu hnh ca my ch FTP! Hy xem cc v d sau: C:\>ftp localhost Connected to dt. 220 dt Microsoft FTP Service (Version 1.0). User (dt:(none)): anonymous 331 Anonymous access allowed, send identity (e-mail name) as password. Password: 230-Windows 95 FTP Service. 230 Anonymous user logged in as anonymous. Yeah! Chc n l server ny l PWS chy trn Windows! Nu nh admin v hiu ha dng qung co trn th sao!? Vn cn cch khc! Bn login vo v pht lnh syst nh sau: ftp> literal syst 215 Windows_NT version 4.10

Hnh nh h iu hnh ca my ch l Win9.x hoc WinNT th phi! (Nu bn ang chy Linux* th ch cn g syst). Hi vng qua bi vit ny, bn s hiu r hn v FTP! Chc bn may mn!

You might also like