php ftp tls,Python FTP隐式TLS连接问题

我需要连接到能够使用lftp成功连接的FTPS服务器.但是,当我尝试使用Python ftplib.FTP_TLS时,它会超时,堆栈跟踪显示它正在等待服务器发送欢迎消息等.有谁知道问题是什么以及如何克服?我想知道是否需要在服务器端进行某些操作,但是lftp客户端如何正常工作.任何帮助是极大的赞赏.

这是堆栈跟踪:

ftp = ftplib.FTP_TLS()

ftp.connect(cfg.HOST, cfg.PORT, timeout=60)

File "C:\Users\username\Softwares\Python27\lib\ftplib.py", line 135, in connect

self.welcome = self.getresp()

File "C:\Users\username\Softwares\Python27\lib\ftplib.py", line 210, in getresp

resp = self.getmultiline()

File "C:\Users\username\Softwares\Python27\lib\ftplib.py", line 196, in getmultiline

line = self.getline()

File "C:\Users\username\Softwares\Python27\lib\ftplib.py", line 183, in getline

line = self.file.readline()

File "C:\Users\username\Softwares\Python27\lib\socket.py", line 447, in readline

data = self._sock.recv(self._rbufsize)

socket.timeout: timed out

使用lftp成功登录到同一个ftps服务器:

$lftp

lftp :~> open ftps://ip_address:990

lftp ip_address:~> set ftps:initial-prot P

lftp ip_address:~> login ftps_user_id ftps_user_passwd

lftp sftp_user_id@ip_address:~> ls

ls: Fatal error: SSL_connect: self signed certificate

lftp ftps_user_id@ip_address:~> set ssl:verif-certificate off

lftp ftps_user_id@ip_address:~> ls

lftp ftps_user_id@ip_address:/>

顺便说一句,我使用的是Python 2.7.3.我使用谷歌做了很多搜索,但没有发现任何有用的信息.

我仍然有这个问题,感谢有人可以提供帮助.仔细查看FTP.connect()与服务器的连接不是问题,但从服务器获取确认(或欢迎消息)是一个问题. lftp没有这个问题,FileZilla没有任何问题,就像在这里的日志 –

Status: Connecting to xx.xx.xx.xxx:990...

Status: Connection established, initializing TLS...

Status: Verifying certificate...

Status: TLS/SSL connection established, waiting for welcome message...

Response: 220- Vous allez vous connecter sur un serveur prive

Response: 220- Seules les personnes habilitees y sont autorisees

Response: 220 Les contrevenants s'exposent aux poursuites prevues par la loi.

Command: USER xxxxxxxxxxxxx

Response: 331 Password required for xxxxxxxxxxxxx.

Command: PASS **********

Response: 230 Login OK. Proceed.

Command: PBSZ 0

Response: 200 PBSZ Command OK. Protection buffer size set to 0.

Command: PROT P

Response: 200 PROT Command OK. Using Private data connection

Status: Connected

Status: Retrieving directory listing...

Command: PWD

Response: 257 "/" is current folder.

Command: TYPE I

Response: 200 Type set to I.

Command: PASV

Response: 227 Entering Passive Mode (81,93,20,199,4,206).

Command: MLSD

Response: 150 Opening BINARY mode data connection for MLSD /.

Response: 226 Transfer complete. 0 bytes transferred. 0 bps.

Status: Directory listing successful

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值