安装: 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