我在 EC2 上設定了 Linux AMI。預設使用者是 ec2-user。我在實例上建立了第二個使用者帳戶。我將 .ssh/authorized_keys 檔案從 ec2-user 主目錄複製到新使用者的主目錄。將 .ssh/ 上的 privs 設為 700,將authorized_keys 設為 600。但是當我以新使用者身分登入時,我收到「權限被拒絕(公鑰)」。訊息.這是我運行 ssh -v -i 時看到的內容:
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: testami-key.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
我該如何解決?謝謝。
答案1
您是否還將authorized_keys 檔案更改為新使用者名稱?您只提到了 chown .ssh 目錄。


