似乎无法通过 Atom 编辑器 Remote FTP 连接到 FTPS

Can't seem to connect to FTPS via Atom editor Remote FTP

我正在尝试通过我的 Atom 编辑器连接到我的 Web 服务器,但是每当我尝试连接到 {"rejectUnauthorized": true,} 时,我都会收到此错误:

Hostname/IP 与证书的别名不匹配:主机:myhost.com。不在证书的别名中:DNS:dns.name

我可以通过以下代码正常连接:

{
    "protocol": "ftp",
    "host": "myhost.com",
    "port": 21,
    "user": "username**",
    "pass": "password**",
    "promptForPass": false,
    "remote": "/",
    "local": "",
    "secure": true,
    "secureOptions": {"rejectUnauthorized": false, "requestCert": true, "agent": false},
    "connTimeout": 10000,
    "pasvTimeout": 10000,
    "keepalive": 10000,
    "watch": [],
    "watchTimeout": 500
}

但是,根据我的阅读,"rejectUnauthorized": false 并不是一种非常聪明的文件传输方式。因为它可能导致 MITM 攻击。

我正在为我的托管使用自动创建的 Let's Encrypt SSL 证书和网站。任何帮助将不胜感激。

提前致谢。

I am using an automatically created Let's Encrypt SSL cert & Siteground for my hosting. Any help would be greatly appreciated.

我不知道 Siteground 的设置 运行,但我的猜测是

  • 这是一个共享主机,即您没有为您的域获得专用 IP 地址,而是与他人共享。
  • Let's Encrypt 证书仅为 HTTPS(即网络访问)安装。
  • 使用 FTPS 时,IP 地址使用单个证书,这就是您所获得的。虽然使用 HTTPS,通过使用 Server Name Indication (SNI) 每个 IP 地址通常有多个证书,但对于其他协议(如 FTPS、SMTPS...
  • 通常情况并非如此

如果我的猜测是正确的,那么这是系统上托管的所有域的共享 FTPS 服务器,对用户数据的访问受用户名+密码限制,而不是用于连接的域名。在这种情况下,您实际上不应该使用自己的域名来访问 FTPS,但您应该使用通用名称(在证书中找到),然后使用您的特定帐户登录。

看起来这甚至被记录在案。来自 Siteground FAQ: How to establish an FTP connection to your hosting account?:

FTP Hostname - This is the hosting server name.

因此,您不应使用自己的域名,而应使用托管服务器的名称。这个名字可以在你的 Account Information.

中找到

万一有人来到这里,因为我正在寻找一些关于如何在使用他们的云托管计划时从 Atom 连接到 SiteGround 服务器的指导,我是这样做的...

我的本地工作站是 Mac。

我正在为 Atom 使用远程 FTP 包:https://atom.io/packages/remote-ftp

在 SiteGround、Site Tools、Devs、SSH 密钥管理器中添加 SSH 密钥。您还可以使用该页面获取私钥的副本 - 将其放入本地工作站的文本文件中。

在 Atom 中,使用远程 FTP 包菜单创建 sftp 配置文件。这是我的:

{
    "protocol": "sftp",
    "host": "example.sg-host.com",
    "port": 18765,
    "user": "u30-xxxxxxxxxx",
    "remote": "/home/u30-xxxxxxxxxx/www/example.sg-host.com",
    "local": "",
    "agent": "env",
    "privatekey": "/Path/to/local/keyfile",
    "passphrase": "the password used when you created the siteground ssh key ",
    "hosthash": "",
    "ignorehost": true,
    "connTimeout": 10000,
    "keepalive": 10000,
    "keyboardInteractive": false,
    "keyboardInteractiveForPass": false,
    "remoteCommand": "",
    "remoteShell": "",
    "watch": [],
    "watchTimeout": 500
}

让我困惑了一段时间的是,您需要在远程 FTP 配置文件中指定的用户是 SSH 凭据中的用户。也许这对某些人来说是显而易见的。但我花了一段时间才意识到你不需要 SiteGround 中的 FTP 用户。 SFTP 通过 SSH FTP,因此 SSH 密钥和凭据就足够了。

我在这个例子中使用了一个临时的 SiteGround 域名。我想,虽然我还没有测试过,但如果你已经为 SiteGround 网站分配了一个域名,你会使用它作为主机。

远程目录 /home/u30-xxxxxxxxxx/www/example.sg-host.com 是您可以找到网站文档根目录的地方,在 SiteGround 上是 public_html.

尽情享受吧!