2016-09-29 122 views
0

我已經創建了一個亞馬遜Ec2實例,我試圖從本地機器ssh進入服務器。我可以使用PEM密鑰,但即使將本地計算機的公鑰添加到授權密鑰後,我也無法登錄。它只是告訴我「權限被拒絕(publickey)」。這是跟蹤。 debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/joelscalera/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey debug1: Trying private key: /var/root/.ssh/id_rsa debug3: no such identity: /var/root/.ssh/id_rsa: No such file or directory debug1: Trying private key: /var/root/.ssh/id_dsa debug3: no such identity: /var/root/.ssh/id_dsa: No such file or directory debug1: Trying private key: /var/root/.ssh/id_ecdsa debug3: no such identity: /var/root/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: /var/root/.ssh/id_ed25519 debug3: no such identity: /var/root/.ssh/id_ed25519: No such file or directory debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey). 如何在沒有PEM密鑰的情況下進入EC2實例?

+2

請注意,是#2只編程相關的問題。請查看[幫助/在線主題],瞭解可在此處詢問哪些主題。這個問題可能適用於其他SE網站,如[超級用戶](http://superuser.com)。首先檢查他們的幫助,看看問題是否屬於那裏,如果是這樣,你可以點擊「標誌」鏈接並選擇「需要管理員注意」來請求遷移。 – kaylum

回答

2

您需要ssh-agent在ssh期間提供您的PEM文件。

首先啓動的ssh-agent:

eval `ssh-agent -s` 

然後添加PEM關鍵代理

ssh-add <pem-key> 

現在你可以不提供PEM SSH協議。

+0

您也可以將上述命令放置在您的配置文件中,以便它們不會在重新啓動後持續 –

1

您可以添加EC2 PEM關鍵要ssh

ssh-add ~/.ssh/key_pair.pem 
相關問題