http://blog.csdn.net/qq_15766181/article/details/46554643

使用 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/virtusers
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/virtusers
session optional pam_keyinit.so force revoke
auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
auth required pam_shells.so
auth include password-auth
account include password-auth
session required pam_loginuid.so
session include password-auth

Linux Vsftpd 连接超时解决方法(被动模式)的更多相关文章

  1. Linux Vsftpd 连接超时解决方法

    Linux Vsftpd 连接超时解决方法 2013-11-13 10:58:34|  分类: 默认分类|举报|字号 订阅     解决方法(http://www.lingdus.com/thread ...

  2. 基于ORA-12170 TNS 连接超时解决办法详解

    转自原文 基于ORA-12170 TNS 连接超时解决办法详解 1.开始----程序-----Oracle------配置和移植工具-----Net Manager----本地----服务命名---o ...

  3. ssh 连接缓慢解决方法

    ssh 连接缓慢解决方法 摘自:https://blog.csdn.net/qq_14821541/article/details/61915589 2017年03月13日 12:00:38 所以怎样 ...

  4. file_get_contents无法请求https连接的解决方法 php开启curl

    file_get_contents无法请求https连接的解决方法 方法1: PHP.ini默认配置下,用file_get_contents读取https的链接,就会如下错误: Warning: fo ...

  5. 因修改/etc/ssh权限导致的ssh不能连接异常解决方法

    因修改/etc/ssh权限导致的ssh不能连接异常解决方法 现象: $ssh XXX@192.168.5.21 出现以下问题 Read from socket failed: Connection r ...

  6. ssh能够连接而sftp不能连接的解决方法

    ssh能够连接而sftp不能连接的解决方法   昨天开始用FileZilla一直不能登录远程的服务器,ssh的登录就OK,因为是服务器,也不敢乱动.查了好多资料终于解决了. 首先,查看一下系统的安全日 ...

  7. linux服务器时间同步失败解决方法

    linux服务器时间同步失败解决方法 1.为什么会时间不同步: ①计算机的时间是根据电脑晶振以固定频率震荡而产生的,由于晶振的不同或者老化,会导致电脑时间积累误差的产 (什么是电脑晶振:http:// ...

  8. Linux时间变慢解决方法

    情景:系统为CentOS-5.4,硬件时间正确(查看硬件时间的方法见下面),系统时间每隔24小时会慢20分钟左右Linux将时钟分为系统时钟(System Clock)和硬件(Real Time Cl ...

  9. Spotlight 连接SuSE11 linux报错的解决方法

    1. 在客户端安装spotlight: 2.在SuSE11中建立新用户,并且安装了sysstat包: 3.使用spotlight连接服务器,连接时提示    errorcode:3114   reas ...

随机推荐

  1. BZOJ 4725: [POI2017]Reprezentacje ró?nicowe

    Description 一个数列. \(a_1=1,a_2=2\) 当 \(n>2\) 时 \[a_n = \{  \begin {matrix} 2a_{n-1},\text{n is an ...

  2. Python函数讲解

    Python函数

  3. CCProxy二级代理上网设置

    假如电脑A可以通过代理服务器上网,B电脑又可以连接A电脑,那么A电脑可以作为二级代理服务器进行上网,需要设置如下: 1.在A电脑上安装CCProxy,以v8.0为例 2.选择设置->高级 3.启 ...

  4. js中选定元素slice()

    选定元素slice() slice() 方法可从已有的数组中返回选定的元素. 语法 arrayObject.slice(start,end) 参数说明: 1.返回一个新的数组,包含从 start 到 ...

  5. libcpmt.lib 与 msvcprt.lib

    https://msdn.microsoft.com/en-us/library/2kzt1wy3(VS.80).aspx

  6. Git命令之资源

    https://git-scm.com/book/zh/v2/Git-%E5%88%86%E6%94%AF-%E5%88%86%E6%94%AF%E7%9A%84%E6%96%B0%E5%BB%BA% ...

  7. Spring中文文档

    前一段时间翻译了Jetty的一部分文档,感觉对阅读英文没有大的提高(*^-^*),毕竟Jetty的受众面还是比较小的,而且翻译过程中发现Jetty的文档写的不是很好,所以呢翻译的兴趣慢慢就不大了,只能 ...

  8. xml 基础学习备忘

    <?xml version="1.0" encoding="UTF-8"? standalone="yes"> 这里的encod ...

  9. 利用Jquery获取、设置iframe中元素

    <iframe id="iframe" src="'+url+'"></iframe>'; //iframe加载完成后 $(" ...

  10. PCA数据降维

    Principal Component Analysis 算法优缺点: 优点:降低数据复杂性,识别最重要的多个特征 缺点:不一定需要,且可能损失有用的信息 适用数据类型:数值型数据 算法思想: 降维的 ...