博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux Vsftpd 连接超时解决方法(被动模式)
阅读量:6932 次
发布时间:2019-06-27

本文共 2262 字,大约阅读时间需要 7 分钟。

 

使用 FileZilla FTP Client 连接 Vsftpd FTP,在没有配置传输模式(主动模式、被动模式)时,出现了以下提示信息。我们可以手工设置传输模式为“主动模式”来解决这一问题。但由于客户端防火墙等原因,这种解决方法将不会始终有效。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
状态: 正在连接 
192.168
.
182.128
:
21
...
状态: 连接建立,等待欢迎消息...
响应: 
220 
(vsFTPd 
2.0
.
5
)
命令: USER bugxm_general
响应: 
331 
Please specify the password.
命令: PASS ******
响应: 
230 
Login successful.
命令: OPTS UTF8 ON
响应: 
200 
Always 
in 
UTF8 mode.
状态: 已连接
状态: 读取目录列表...
命令: PWD
响应: 
257 
"/"
命令: TYPE I
响应: 
200 
Switching to Binary mode.
命令: PASV
响应: 
227 
Entering Passive Mode (
192
,
168
,
182
,
128
,
172
,
85
)
命令: LIST
错误: 连接超时
错误: 读取目录列表失败

解决方法

在服务端配置被动模式就可以从根源上解决这问题。

1、编辑 Vsftpd  配置文件

1
vi /etc/vsftpd/vsftpd.conf

2、在最下面添加以下信息

1
2
3
pasv_enable=YES         #开启被动模式
pasv_min_port=
4000      
#随机最小端口
pasv_max_port=
5000      
#随机最大端口

3、加载内核 ip_conntrack_ftp 和 ip_nat_ftp(终端执行)

1
2
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp

4、配置 iptables 开放 4000 到 5000 端口

1
vi /etc/sysconfig/iptables  在*filter下加入下
1
2
-A OUTPUT -p tcp --sport 
4000
:
5000 
-j ACCEPT
-A INPUT -p tcp --dport 
4000
:
5000 
-j ACCEPT

5、加载 iptables 配置

1
iptables-restore < /etc/sysconfig/iptables

6、重启 Vsftpd

1
service vsftpd restart

测试连接

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
状态: 正在连接 
192.168
.
182.128
:
21
...
状态: 连接建立,等待欢迎消息...
响应: 
220 
(vsFTPd 
2.0
.
5
)
命令: USER bugxm_general
响应: 
331 
Please specify the password.
命令: PASS ******
响应: 
230 
Login successful.
命令: OPTS UTF8 ON
响应: 
200 
Always 
in 
UTF8 mode.
状态: 已连接
状态: 读取目录列表...
命令: PWD
响应: 
257 
"/"
命令: TYPE I
响应: 
200 
Switching to Binary mode.
命令: PASV
响应: 
227 
Entering Passive Mode (
192
,
168
,
182
,
128
,
15
,
224
)
命令: LIST
响应: 
150 
Here comes the directory listing.
响应: 
226 
Directory send OK.
状态: 列出目录成功

 

#%PAM-1.0 [/etc/pam.d/vsftpd, 注意是lib还是lib64, 登录失败 可 tail -f /var/log/secure 查看详情]auth    sufficient      /lib64/security/pam_userdb.so     db=/etc/vsftpd/virtusersaccount sufficient      /lib64/security/pam_userdb.so     db=/etc/vsftpd/virtuserssession    optional     pam_keyinit.so    force revokeauth       required     pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeedauth       required     pam_shells.soauth       include      password-authaccount    include      password-authsession    required     pam_loginuid.sosession    include      password-auth

 

 

转载地址:http://kqljl.baihongyu.com/

你可能感兴趣的文章
Flink批处理中的增量迭代
查看>>
Mac OS X各版本的历史费用和升级关系
查看>>
SharePoint 2016 配置向导报错 - The &#39;ListInternal&#39; attribute is not allowed
查看>>
js String Trim函数
查看>>
MFC使用自定义资源加载PNG
查看>>
笔记类app之Leanote同步机制 韩俊强的博客
查看>>
我的WCF之旅(2):Endpoint Overview
查看>>
阿里云播放器单击切换播放/暂停
查看>>
Android Input子系统:Input进程的创建,监听线程的启动
查看>>
勒索软件恢复:短期损失难免,但长远益处大
查看>>
【译】系统设计入门之面试题解答 —— 设计一个网页爬虫
查看>>
数据缺失的坑,无监督学习这样帮你补了
查看>>
kafka数据可靠性深度解读
查看>>
智能家居新宠:MATO云门铃体验评测
查看>>
[译] 你的站点如你所想的移动友好吗?
查看>>
集中网络管控, 保障运维安全
查看>>
我的2017云栖之行
查看>>
java-基础-数组探究
查看>>
云计算在五年之内将成为黑客攻击重点
查看>>
Openstack组件实现原理 — Nova 体系结构
查看>>