0

我目前使用ssh连接远程aws实例,这是ubuntu 。首先我可以完美地连接它。但是,我将ec2实例的ssh密钥(.pem文件)从Download下载到我自己的笔记本上的.ssh文件夹后,它显示Could not resolve hostname mypath/myssh.pem provided, or not known。我很确定,用户名和服务器名称没有任何问题。 有什么我缺少设置?
此外,虽然ssh -v这表明debug1: Trying private key: Mypathtokey/my.pem debug1: Authentications that can continue: publickey debug1: No more authentication methods to try.AWS连接被拒绝

编辑 我的命令

ssh -i ~/.ssh/my.pem [email protected] 

我还设置ssh aws在ssh_config中。当使用ssh -vvv aws时,它显示

debug1: Next authentication method: publickey 
debug1: Trying private key: /Users/mypath/.ssh/ssh.pem 
debug2: storing passphrase in keychain 
debug3: Search for existing item with query: { 
    acct = "/Users/mypath/.ssh/ssh.pem"; 
    agrp = "com.apple.ssh.passphrases"; 
    class = genp; 
    labl = "SSH: /Users/mypath/.ssh/ssh.pem"; 
    nleg = 1; 
    "r_Ref" = 1; 
    svce = OpenSSH; 
} 
debug3: Item already exists in the keychain, updating. 
debug3: sign_and_send_pubkey: RSA SHA256: my rsa sha256 keyvalue 
debug3: receive packet: type 51 
debug1: Authentications that can continue: publickey 
debug2: we did not send a packet, disable method 
debug1: No more authentication methods to try. 
Permission denied (publickey). 
+0

显示您正在使用的命令。 – Justinas

+0

*“将我的ssh密钥移到另一个文件夹后”* ...哪个密钥?在服务器或客户端?为什么? – Jakuje

+0

我将ec2实例的ssh密钥(.pem文件)从Download下载到我自己的笔记本上的.ssh文件夹,因为我试图在我的Downloads文件中首次与ec2实例建立连接 – EEEEEric

回答

0

您是否检查了.pem文件的权限?尝试将其更改为600并连接。希望能够解决问题。