$ ssh mykey.pem [email protected] -v
OpenSSH_7.3p1, OpenSSL 1.0.2j 26 Sep 2016
debug1: Reading configuration data /c/Users/works/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 10.128.2.7 [10.128.2.7] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/works/Documents/interface setup/ifx_key.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/works/Documents/interface setup/ifx_key.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to 10.128.2.7:22 as 'ubuntu'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:R+d2ELtCJyoeyHMfivCsGKk98GOIfxxsTEPAFmKkSOI
debug1: Host '10.128.2.7' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/works/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/works/Documents/interface setup/ifx_key.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
直到昨天我才能够通过 ssh 进入这台机器。有办法登录吗?
答案1
.ssh/authorized_keys
仅当您有服务器上引用的私钥时。您是否删除了该文件或更改了其内容?
如果您删除了该信息,并且您无法对磁盘进行物理访问,则您将无法再次登录服务器。
这是基本的 ssh 安全性,如果您没有 中提到的适当密钥.ssh/authorized_keys
,您将无法访问。这样您就可以确保其他人无法轻松访问您的服务器。
答案2
$ ssh mykey.pem [email protected] -v
...
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/works/Documents/interface setup/ifx_key.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/works/Documents/interface setup/ifx_key.pem-cert type -1
...
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/works/Documents/interface setup/ifx_key.pem
debug1: Authentications that can continue: publickey
您的客户尝试使用的唯一密钥是ifx_key.pem
。看起来该文件实际上并不存在(“type -1”行)。如果这是 ssh 应该用来进行身份验证的密钥,请确保该文件确实存在于您的本地系统上并且您有权读取它。
$ ssh mykey.pem [email protected] -v
这表明您希望 ssh 使用名为 的不同密钥文件mykey.pem
,但您没有正确指定命令。要在命令行上指定键,请使用以下-i
选项:
$ ssh -i mykey.pem [email protected] -v