我正在尝试登录到一个ftps站点。我尝试在命令行中提供登录creds (并将set参数放入~/.lftprc中,然后打开lftp会话并使用lftp作业控制语句键入这些参数。不管怎么说,我总是碰到同样的路障:
421 Sorry, cleartext sessions are not accepted on this server.
Please reconnect using SSL/TLS security mechanisms.我从以下参数中得到了最大的误差,但是继续得到上面的错误。
如何让lftp 从命令行使用SSL/TLS安全机制?
目标是使用bash (不使用expect编程)编写对这个ftps站点的访问脚本。
lftp
lftp :~> set ssl-allow false
lftp :~> set passive-mode yes
lftp :~> open ftp.abc.com
lftp ftp.abc.com:~> login theuser
Password:
lftp theuser@ftp.abc.com:~> cd
`cd' at 0 [Delaying before reconnect: 26]
CTRL-C
lftp theuser@ftp.abc.com:~> debug
lftp theuser@ftp.abc.com:~> cd
---- Connecting to ftp.abc.com (XX.XXX.XX.XX) port 21
<--- 220-Welcome to the Yahoo! Web Hosting FTP server
<--- 220-Need help? Get all details at:
<--- 220-http://help.yahoo.com/help/us/webhosting/gftp/
<--- 220-
<--- 220-No anonymous logins accepted.
<--- 220-Yahoo!
<--- 220-Local time is now 15:30. Server port: 21.
<--- 220-This is a private system - No anonymous login
<--- 220 You will be disconnected after 5 minutes of inactivity.
---> FEAT
<--- 211-Extensions supported:
<--- EPRT
<--- IDLE
<--- MDTM
<--- SIZE
<--- MFMT
<--- REST STREAM
<--- MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
<--- MLSD
<--- XDBG
<--- AUTH TLS
<--- PBSZ
<--- PROT
<--- TVFS
<--- ESTA
<--- PASV
<--- EPSV
<--- SPSV
<--- ESTP
<--- 211 End.
---> OPTS MLST type;size;modify;UNIX.mode;UNIX.uid;UNIX.gid;
<--- 200 MLST OPTS type;size;sizd;modify;UNIX.mode;UNIX.uid;UNIX.gid;unique;
---> USER theuser
<--- 421 Sorry, cleartext sessions are not accepted on this server.
Please reconnect using SSL/TLS security mechanisms.发布于 2014-05-28 05:04:48
lftp :~>设置ssl-允许false
您已经显式地设置了ssl-允许为false。但是,如果lftp试图使用SSL,则这必须是正确的。
发布于 2017-05-21 10:23:28
在许多系统上,似乎没有正确配置lftp,这使得它无法验证服务器证书(生成Fatal error: Certificate verification: Not trusted)。
web (以及本文中的答案)充满了通过禁用证书验证或加密来解决这个问题的建议。这是不安全的,因为它允许中间人攻击通过而不被注意到.
更好的解决方案是正确配置证书验证,这很容易,幸运的是。为此,将以下行添加到/etc/lftp.conf (或者是~/.lftp/rc或~/.config/lftp/rc):
set ssl:ca-file "/etc/ssl/certs/ca-certificates.crt"ca-certificates.crt是一个包含系统所有CA证书的文件。上面使用的位置是来自Ubuntu的位置,在不同的系统上可能会有所不同。若要生成或更新文件,请运行update-ca-certificates
sudo update-ca-certificates如果您的系统没有此命令,您可以手动创建一个这样的命令:
cat /etc/ssl/certs/*.pem | sudo tee /etc/ssl/certs/ca-certificates.crt > /dev/null发布于 2014-12-09 05:26:26
你也可能需要
set ssl:verify-certificate nohttps://stackoverflow.com/questions/23900071
复制相似问题