-1

Can anyone help me fix this issue, I am trying to access Amazon Instance via ssh from another amazon instance, but I am getting the following error-

[ec2-user@ip-172-31-28-27 jmeter-ec2-master]$ ssh -i "JmeterCloud-Updated.pem" ec2-user@ec2-52-38-189-49.us-west-2.compute.amazonaws.com

Permission denied (publickey).

Any help will be much appreciated

user2885295
  • 329
  • 1
  • 4
  • 12
  • Publish more error message . There can be different error in between. – mootmoot May 03 '16 at 12:26
  • Check again whether you are using the correct privatekey associate with ec2-52-38-189-49 . – mootmoot May 03 '16 at 15:39
  • 1
    Possible duplicate of [Permission denied (publickey) when SSH Access to Amazon EC2 instance](http://stackoverflow.com/questions/18551556/permission-denied-publickey-when-ssh-access-to-amazon-ec2-instance) – tedder42 May 03 '16 at 16:11

2 Answers2

0

Did You Use the chmod command to make sure your private key file isn't publicly viewable. For example, if the name of your private key file is my-key-pair.pem, use the following command:

chmod 400 /path/my-key-pair.pem

Kush Vyas
  • 5,813
  • 2
  • 26
  • 36
  • the server cares about the permissions of the `~/.ssh/authorized_keys` file (and directory), the permission of the pem file on the client host is irrelevant in this case. – mata May 03 '16 at 11:44
0

Use the following:

chmod 600 JmeterCloud-Updated.pem

to give adequate access to the key and then try to login into that instance.

Itai Bar-Haim
  • 1,686
  • 16
  • 40
Bhati
  • 129
  • 1
  • 1
  • 4
  • the server cares about the permissions of the `~/.ssh/authorized_keys` file (and directory), the permission of the pem file on the client host is irrelevant in this case. – mata May 03 '16 at 11:44
  • 1
    Some ssh client will warn the user if private-key permission too open. – mootmoot May 03 '16 at 12:27