AWS connection denied

57 Views Asked by At

I am currently using ssh to connect my remote aws instance which is ubuntu .At first I could connect to it perfectly. However, after I move the ssh key(.pem file) of ec2 instance from Download to .ssh folder on my own laptop, it shows that Could not resolve hostname mypath/myssh.pem provided, or not known. I am pretty sure that nothing wrong over username and the server name. Is there something that I am missing to set ?
Besides, while ssh -v it shows that debug1: Trying private key: Mypathtokey/my.pem debug1: Authentications that can continue: publickey debug1: No more authentication methods to try.

edit my command

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

I also set ssh aws in ssh_config. while using ssh -vvv aws, it shows that

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).
1

There are 1 best solutions below

0
Manoj Prabhakar On

Did you check the permission of your .pem file ? try changing it to 600 and connect. Hope that will solve the problem.