我目前正在使用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.
编辑 我的命令
ssh -i ~/.ssh/my.pem ubuntu@myawsDNSserver.com
我还在ssh_config中设置了ssh aws
。在使用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 :(得分:0)
您是否检查过.pem文件的权限?尝试将其更改为600并连接。希望能解决问题。