安裝: linux
1.檢測是否已經安裝了vsftpd。執行命令: 瀏覽器
rpm -qa | grep vsftpd app
若是出現返回值,則說明已經安裝,不然是未安裝。 tcp
2.開始安裝.執行命令: spa
yum install vsftpd 日誌
3.設置爲開機啓動項,執行命令: orm
chkconfig vsftpd on 接口
4.開放端口20和21端口,執行命令: ip
iptables -A INPUT -p tcp --dport 21 -j -ACCEPT ci
iptables -A OUTPUT -p tcp --sport 21 -j -ACCEPT
iptables -A INPUT -p tcp --dport 20 -j -ACCEPT
iptables -A OUTPUT -p tcp --sport 20 -j -ACCEPT
service iptables save——————————保存配置信息
iptables -L -n——————————查看接口開放狀況
5.更改selinux模式(若是容許的話):
setenforce 0——————將selinux模式改成寬容模式,不須要重啓
或者將selinux模式設爲disable:
vi /etc/selinux/config
SELINUX=disbale————————————這樣作的話須要重啓機子
6.能夠經過修改/etc/vsftpd/vsftpd.conf,更改vsftpd的配置.
----------------------------------------------------------------------------------------------
參考配置:
anonymous_enable=NO————————是否容許匿名登陸
local_enable=YES————————設定本地用戶是否能夠登陸(主要針對虛擬用戶)
write_enable=YES————————設定是否能夠進行寫操做
local_umask=022————————設定上傳後文件的權限掩碼
dirmessage_enable=YES——————設定開啓目錄標語功能
connect_from_port_20=YES————————設定端口20進行數據鏈接
xferlog_file=/var/log/vsftpd.log——————————設定端口使用標準的記錄格式
xferlog_enable=YES————————設定開啓日誌記錄功能
log_ftp_protocol=YES——————————是否將全部FTP請求和相應記錄到日誌中。啓動此項時xferlog_std_format不能被啓動。
ascii_upload_enable=YES——————————設定支持ASCII模式的上傳功能
ascii_download_enable=YES——————————設定支持ASCII模式的下載功能
listen=YES————————設定該vsftpd服務在STANDALONE模式下工做
pam_service_name=vsftpd——————設定PAM服務下Vsftpd的驗證配置文件名
tcp_wrappers=YES————————設定支持TCP Wrappers.
chroot_list_enable=NO——————————是否設定chroot_list_file配置制定的用戶列表文件。
chroot_local_user=NO——————————用於指定用戶列表文件中的用戶是否容許切換到上級目錄.
pasv_enable=YES————————若設置爲YES使用PASV模式,設置爲NO使用PORT模式
--------------------------------------------------------------------------------------------
添加用戶:
執行命令:
1.useradd rainman -d /home/rainman/ -s /sbin/nologin
2.passwd rainman
3.兩次輸入密碼
經過此方法建立了一個用戶,該用戶不能登陸,只能提供ftp使用
能夠執行vi /etc/passwd,修改用戶的信息;
---------------------------------------------------------------------------------------------
問題:
win7下用dos能夠登錄,可是不知道爲何沒法用瀏覽器登錄?求大神幫助。。。
日誌以下:
Fri Apr 4 10:30:36 2014 [pid 4319] CONNECT: Client "xxx.xxx.xxx.xxx"
Fri Apr 4 10:30:36 2014 [pid 4319] FTP response: Client "xxx.xxx.xxx.xxx", "220 (vsFTPd 2.2.2)"
Fri Apr 4 10:30:36 2014 [pid 4319] FTP command: Client "xxx.xxx.xxx.xxx", "USER rainman"
Fri Apr 4 10:30:36 2014 [pid 4319] [rainman] FTP response: Client "xxx.xxx.xxx.xxx", "331 Please specify the password."
Fri Apr 4 10:30:36 2014 [pid 4319] [rainman] FTP command: Client "xxx.xxx.xxx.xxx", "PASS <password>"
Fri Apr 4 10:30:36 2014 [pid 4318] [rainman] OK LOGIN: Client "xxx.xxx.xxx.xxx"
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP response: Client "xxx.xxx.xxx.xxx", "230 Login successful."
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP command: Client "xxx.xxx.xxx.xxx", "SYST"
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP response: Client "xxx.xxx.xxx.xxx", "215 UNIX Type: L8"
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP command: Client "xxx.xxx.xxx.xxx", "PWD"
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP response: Client "xxx.xxx.xxx.xxx", "257 "/home/rainman""
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP command: Client "xxx.xxx.xxx.xxx", "TYPE I"
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP response: Client "xxx.xxx.xxx.xxx", "200 Switching to Binary mode."
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP command: Client "xxx.xxx.xxx.xxx", "PASV"
Fri Apr 4 10:30:36 2014 [pid 4323] [rainman] FTP response: Client "xxx.xxx.xxx.xxx", "227 Entering Passive Mode (xxx.xxx.xxx.xxx,26,126)."
Fri Apr 4 10:30:57 2014 [pid 4323] [rainman] FTP command: Client "xxx.xxx.xxx.xxx", "QUIT"
Fri Apr 4 10:30:57 2014 [pid 4323] [rainman] FTP response: Client "xxx.xxx.xxx.xxx", "221 Goodbye."
參考信息:
selinux
iptables