0

我目前正在使用 ssh 连接我的远程 aws 实例,它是 ubuntu 。起初我可以完美地连接到它。但是,在我将 ec2 实例的 ssh 密钥(.pem 文件)从下载移动到我自己笔记本电脑上的 .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.

编辑我的命令

ssh -i ~/.ssh/my.pem ubuntu@myawsDNSserver.com

我也在ssh awsssh_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).
4

1 回答 1

0

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

于 2016-11-25T07:52:08.380 回答