Professional Documents
Culture Documents
FTP
dr inż. Andrzej Chmielewski
Wydział Informatyki
Politechniki Białostockiej
Serwer FTP
Architektura: klient-serwer.
FTP
Tryby połączeń
FTP
Tryby połączeń
Tryb aktywny
Przykład:
●
klient łączy się z serwerem z portu 1050 na port 21
●
klient wysyła port 1051 (1050 + 1) do serwera, który odpowiada flagą
ACK na połączeniu kontrolnym
● FTP
serwer otwiera połączenie danych z portu 20 na port 1051 klienta
●
klient wysyła flagę ACK na połączeniu danych
Tryby połączeń
Tryb pasywny
FTP
Firewall z FTP
Przykład firewalla
http://www.cyberciti.biz/faq/iptables-passive-ftp-is-not-working/)
#!/bin/bash
# Sample iptables shell script to deal with FTP server issues including
# active and passive FTP connections issues.
IPT=/sbin/iptables
$IPT -F
$IPT -X
$IPT -t nat -F
$IPT -t nat -X
$IPT -t mangle -F
$IPT -t mangle -X
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
FTP
Serwer vsFTPd
https://security.appspot.com/vsftpd.html
Instalacja
# apt-get install vsftpd
# yum install vsftpd
Pierwszy test:
$ ftp 127.0.0.1
Connected to 127.0.0.1.
220 (vsFTPd 3.0.2)
Name (127.0.0.1:student):
331 Please specify the password.
Password:
230 Login successful. FTP
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quit
221 Goodbye.
Serwer vsFTPd
FTP
Serwer vsFTPd
Wybrane polecenia
Wybrane polecenia
FTP
Serwer FTP
$ ftp 10.64.104.252
Connected to localhost.
220 (vsFTPd 3.0.2)
Name (localhost:student):
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-rw-r-- 1 1000 1000 0 Feb 18 04:55 test
226 Directory send OK.
ftp> passive FTP
Passive mode on.
ftp> get test
…..