Sublime SFTP 中的密钥被拒绝,但在 PuTTY 中可以使用

Sublime SFTP 中的密钥被拒绝,但在 PuTTY 中可以使用

几年来,我一直使用 Sublime Text 上的 SFTP 包连接 AWS EC2 实例,从未遇到过任何问题。今天我创建了一个新实例,但不知何故无法连接它。

当我尝试连接到任何其他实例时,连接都可以正常工作。当我尝试使用 PuTTY 连接时,连接也可以正常工作。只有当我尝试通过 Sublime Text 连接时才会出现问题。

sftp-配置.json:

{
    "type": "sftp",

    "save_before_upload": true,
    "upload_on_save": true,
    "sync_down_on_open": true,
    "sync_skip_deletes": false,
    "sync_same_age": true,
    "confirm_downloads": false,
    "confirm_sync": true,
    "confirm_overwrite_newer": false,

    "host": "00.000.000.000",
    "user": "<Username>",
    "port": "22",

    "remote_path": "/var/www/html/",
    "ignore_regexes": [
        "\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
        "sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
        "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
    ],
    "file_permissions": "755",
    "dir_permissions": "755",

    "connect_timeout": 30,
    "ssh_key_file": "C:/AWS Key Pairs.ppk",
}

Sublime 控制台:

Connecting to SFTP server "00.000.000.000" as "<Username>" ........... failure (Connection timeout)

sublime_sftp_debug.txt:

2022-06-01 00:12:19, SFTP Read:
    Using username "<Username>".
    Server refused our key
    FATAL ERROR: No supported authentication methods available (server sent: publickey)

远程服务器的auth.log:

Jun  1 04:12:18 ip-000-00-00-000 sshd[59492]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Jun  1 04:12:18 ip-000-00-00-000 sshd[59492]: Connection closed by authenticating user <Username> 00.00.000.00 port 49161 [preauth]

有人知道为什么会发生此问题吗?在此错误之前,还出现了另一个与 PuTTYgen 生成的密钥版本有关的错误。也许是在生成私钥时的其他配置,但我已经尝试遵循了几个不同的教程,但都没有奏效。

答案1

我猜你的服务器已经更新为需要 rsa-sha2。而 Sublime(或你的版本)尚不支持它。

确保您拥有最新版本的 Sublime。

如果事实证明 Sublime 尚不支持 rsa-sha2,则需要重新配置服务器以通过添加到PubkeyAcceptedAlgorithms +ssh-rsa来允许旧的“RSA” sshd_config

相关内容