Mobaxterm - 權限被拒絕(Publickey)

Mobaxterm - 權限被拒絕(Publickey)

我在透過 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。在不在「程式」下的某個位置重新安裝,因為您不再具有對那裡的寫入存取權。

相關內容