EC2 instance can be accessed by using different account pem if your ip address is whitelist for same region

0

Hi, EC2 instance can be accessed by using different account pem if your ip address is whitelist for same region. Is it expected or bug from aws side?

  • Whay do you mean by account pem ?

  • Question makes no sense

  • can you clarify and give more context?

  • I mean that I am able to use access key of aws account A to access EC2 instance of another aws account B in same region.

Ranjeet
已提问 1 年前301 查看次数
1 回答
1

A ssh private key (PEM key), is a security credentials that you use to prove your identity when connecting to an Amazon EC2 instance. Neither it has relation with AWS Account nor with AWS regions, rather it is related to the machine/instance.

For Linux instances, the private key allows you to securely SSH into your instance. Key pair can be created using the Amazon EC2 console or a third-party tool.

If you specify a key pair at launch, when your instance boots for the first time, the public key material is placed on your Linux instance in an entry within ~/.ssh/authorized_keys. Additionally you may append the public key on the Linux instance for a specific user, the path to the file is ~/.ssh/authorized_keys.

To fetch the public key from a private key (PEM), you may execute the following command:

$ ssh-keygen -yf ssh_key_name.pem

Since you are able to use the same private key, you must see same public key hash on both the instances in ~/.ssh/authorized_keys.

Anyone who has the .pem can ssh to your instance without the need for any other AWS credentials since the associated public key is available on the instance.

You may refer:

Amazon EC2 key pairs and Linux instances: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

Add or remove a public key on your instance: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

You may also refer the following third-party article:

What is SSH Public Key Authentication? https://www.ssh.com/academy/ssh/public-key-authentication

profile pictureAWS
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则