lftp 挂在“正在连接”上

drm*_*wer 2 ftp ubuntu cloud9-ide lftp

我使用 lftp 将文件从 Cloud 9 IDE 传输到远程主机。最近好像停止工作了。我已经向主持人提出了这个问题,他们认为效果很好。事实上,我可以通过 FileZilla 和简单的浏览器连接到 ftp 主机。我已经用 Cloud 9 提高了它,但也没有运气。

我正在使用命令行中的以下命令传输文件:

lftp -e "debug; set ssl:verify-certificate no; put ./res/test.txt -o test.txt; bye" -u abcd,xyz ftp.example.com
Run Code Online (Sandbox Code Playgroud)

(这set ssl:verify-certificate no是不久前添加的,为了克服突然出现的类似连接问题......我也尝试过没有它......同样的结果)

我在 C9 中发现的是永远尝试连接:

---- Connecting to ftp.example.com (xx.xxx.xx.xxx) port 21
**** Socket error (Connection timed out) - reconnecting
---- Closing control socket
---- Connecting to ftp.example.com (xx.xxx.xx.xxx) port 21
**** Socket error (Connection timed out) - reconnecting
---- Closing control socket
---- Connecting to ftp.example.com (xx.xxx.xx.xxx) port 21
Run Code Online (Sandbox Code Playgroud)

可能很难提供任何帮助,但是有人有任何想法至少可以帮助我诊断吗?还有其他选项可以尝试吗?

谢谢。

Ant*_*ton 6

在我的例子中,lftp 没有指示 ssh 显式使用“密码身份验证”,并且它一直在等待键盘输入密码

<--- debug1: Authentications that can continue: keyboard-interactive,password
<--- debug1: Next authentication method: keyboard-interactive 
<--- Password authentication
Run Code Online (Sandbox Code Playgroud)

将 sftp:connect-program 设置为后,"ssh -oPreferredAuthentications=password -a -x"我解决了这个问题。

lftp << !
  set sftp:connect-program "ssh -oPreferredAuthentications=password -a -x"
  open -u $USER --env-password $PROTOCOL://$HOST
  mirror -vvv -c --only-missing -P 600 $SRC_FOLDER /dbfs/mnt/$HOST/$DST_FOLDER
!
Run Code Online (Sandbox Code Playgroud)

如果您仍然遇到问题,那么您可以启用调试并通过传递-vtossh-dto来查看出了什么问题open

lftp << !
  set sftp:connect-program "ssh -a -x -v"
  open -d -u $USER --env-password $PROTOCOL://$HOST
  ls
!
Run Code Online (Sandbox Code Playgroud)