Mobaxterm-权限被拒绝(公钥)

Mobaxterm-权限被拒绝(公钥)

通过 mobaxterm 连接到 AWS 中的 Linux 实例时遇到一些问题。尝试通过 SSH 连接到服务器时出现以下错误;


[2018-02-16 10:07.57]  ~
[bunde.DESKTOP-A0APQ1T] ➤ ssh -v -i "XYZ.pem" servername.eu-west-2.compute.amazonaws.com
OpenSSH_7.1p2, OpenSSL 1.0.1g 7 Apr 2014
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to servername.eu-west-2.compute.amazonaws.com [x.x.x.x] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /var/keys/.10996.ssh type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/keys/.10996.ssh-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to servername.eu-west-2.compute.amazonaws.com:22 as 'bunde'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 [email protected]
debug1: kex: client->server aes128-ctr hmac-sha1 [email protected]
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256: ...
debug1: Host 'servername.eu-west-2.compute.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/mobaxterm/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: pubkey_prepare: ssh_fetch_identitylist: agent refused operation
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /var/keys/.10996.ssh
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
**Permission denied (publickey).**

有什么想法吗?我尝试过调整文件权限(从我的 Mac 上我知道密钥必须被很好地锁定),但任何更改似乎都不会影响我收到的错误。

答案1

看起来你的问题出在文件权限上,你能否通过 mobaxterm 检查密钥是否位于你尝试运行 ssh 命令的文件夹中?

ls -lh从 Mobaxterm 控制台运行并检查文件XYZ.pem是否存在,以及运行 mobaxterm 的用户的所有者和组,此外还具有权限 600(-rw-------)。

我不是 MAC 专家,但我很确定它默认有一个 ssh 客户端,看看这个关联

答案2

卸载 Mobaxterm。重新安装在程序之外的某个地方,因为您不再具有那里的写权限。

相关内容