我正在尝试通过FTPS连接从远程服务器下载文件。这可以在同一台计算机上使用CLI ftp-ssl 客户端。但是,当使用 Net :: FTPSSL 时,我收到无法构建数据连接:不允许操作
这是代码的精简部分:
my $ftp = Net::FTPSSL->new($remote_host,
Debug => 7,
Passive => 1,);
my $logrc = $ftp->login($user, $pass);
my $cdrc = $ftp->cwd($remotedir);
my $binrc = $ftp->binary();
my $content;
open my $hd_content, '>', \$content;
my $getrc = $ftp->get($filename, $hd_content);
这就是我得到的
>>> USER +++++++
<<< 331 Password required for <++++++>
>>> PASS *******
<<< 230 User <++++++> logged in
>>> HELP
<<< 214-The following commands are recognized (* =>'s unimplemented):
<<< CWD XCWD CDUP XCUP SMNT* QUIT PORT PASV
<<< EPRT EPSV ALLO* RNFR RNTO DELE MDTM RMD
<<< XRMD MKD XMKD PWD XPWD SIZE SYST HELP
<<< NOOP FEAT OPTS AUTH CCC* CONF* ENC* MIC*
<<< PBSZ PROT TYPE STRU MODE RETR STOR STOU
<<< APPE REST ABOR USER PASS ACCT* REIN* LIST
<<< NLST STAT SITE MLSD MLST
<<< 214 Direct comments to root@localhost
>>> FEAT
<<< 211-Features:
<<< MDTM
<<< MFMT
<<< LANG fr-FR;it-IT;zh-TW;zh-CN;ja-JP;en-US;bg-BG;ru-RU;ko-KR
<<< TVFS
<<< UTF8
<<< AUTH TLS
<<< MFF modify;UNIX.group;UNIX.mode;
<<< MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;
<<< PBSZ
<<< PROT
<<< REST STREAM
<<< SIZE
<<< 211 End
<<+ 111 Auto-adding OPTS Command!
>>> HELP SITE
<<< 214-HELP
<<< CHGRP
<<< 214 CHMOD
<<+ 214 The HELP command is supported.
>>> CWD $remotedir
<<< 250 CWD command successful
>>> TYPE I
<<< 200 Type set to I
>>> PBSZ 0
<<< 200 PBSZ 0 successful
>>> PROT P
<<< 200 Protection set to Private
>>> PASV
<<< 227 Entering Passive Mode (185,24,65,201,237,123).
--- Host ($remote_host) Port (60795)
>>> RETR $filename
<<< 150 Opening BINARY mode data connection for $filename (1004 bytes)
<<< 425 Unable to build data connection: Operation not permitted
我尝试使用相同的结果 $ ftp-&gt; force_epsv 。不幸的是我无法尝试 Net :: FTP ,因为安装的版本不支持SSL。我以root身份运行脚本。 Perl版本是5.14.2,Net :: FTPSSL 0.35