使用 sftp 连接到“FTP over TLS”

使用 sftp 连接到“FTP over TLS”

我现在已经在这上面浪费了一个多小时,我认为这应该非常简单......

我有一个 Azure 网站,允许我使用 sftp 连接并部署到它。我可以使用 FileZilla 通过以下设置很好地连接到它:

  • 主机:azure门户指定的主机
  • 端口:空
  • 协议:FTP - 文件传输协议
  • 加密:需要基于 TLS 的隐式 FTP
  • 登录类型:普通
  • 用户:Azure 门户提供的用户名
  • 密码:Azure 门户提供的密码。

但我不想使用 FileZilla 连接到它。我想使用命令行移动文件。我一直在尝试使用sftpftpscp都没有成功。最终他们都失败了,原因如下:

$ sftp -v -oPort=990 [email protected]
OpenSSH_7.9p1, OpenSSL 1.0.2r  26 Feb 2019
debug1: Reading configuration data /home/rg/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 17: Applying options for *
debug1: Connecting to xxxxxxx.azurewebsites.windows.net [xxx.xxx.xxx.xxx] port 990.
debug1: Connection established.
debug1: identity file /home/rg/.ssh/id_rsa type 0
debug1: identity file /home/rg/.ssh/id_rsa-cert type -1
debug1: identity file /home/rg/.ssh/id_dsa type -1
debug1: identity file /home/rg/.ssh/id_dsa-cert type -1
debug1: identity file /home/rg/.ssh/id_ecdsa type -1
debug1: identity file /home/rg/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/rg/.ssh/id_ed25519 type -1
debug1: identity file /home/rg/.ssh/id_ed25519-cert type -1
debug1: identity file /home/rg/.ssh/id_xmss type -1
debug1: identity file /home/rg/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
ssh_exchange_identification: Connection closed by remote host
Connection closed.
Connection closed

我测试过使用的OpenSSL版本支持TLS 1.2。已知主机中也没有具有其他指纹的主机。

我希望有人能在这里帮助我。

答案1

FTP(通过 TLS)不是 SFTP。

如果您可以使用 FTP 与 FileZilla 进行连接,则必须使用命令行 FTP 客户端。不是 SFTP 客户端。尽管并非所有命令行 FTP 客户端都支持 TLS 加密。

答案2

这又是 FTP 和 SSH 之间的混淆:

  • FTPS 是基于 TLS 的 FTP(比较:HTTPS 是基于 TLS 的 HTTP)。它使用 TCP 端口 21,如果不是被动模式,防火墙必须允许来自外部的连接。
  • SFTP 是 SSH 的一个子系统。它使用 TCP 端口 22。

FileZilla 两者都支持。

相关内容