Scott W.
Scott W.

Reputation: 73

Why we get a pem file when creating a VM on Microsoft Azure?

I'm recently working on creating a cloud instance on Azure. Once I created a new VM for the service I need, it always lets me download a pem file. However, it seems like I can log in to the VM through SSH without using the pem file.

Besides that, when I check the "authorized_keys" file on the new VM, it includes a public key, which is not the one on my local machine's "id_rsa.pub" file.

I'm wondering how I could log in without the public key stored in the authorized_keys file?

I think this question is related to SSH, thanks in advance!

Upvotes: 2

Views: 3118

Answers (1)

Gaurav
Gaurav

Reputation: 66

Why we get a pem file when creating a VM on Microsoft Azure?

Disabling password logins to SSH is a common practice for SSH hardening [1,2]. The PEM file provided by default will help you achieve this.

Besides that, when I check the "authorized_keys" file on the new VM, it includes a public key, which is not the one on my local machine's "id_rsa.pub" file

I believe you are viewing the file for another user or comparing the wrong keys.

I'm wondering how I could log in without the public key stored in the authorized_keys file?

You could change the authorized_keys file you are referring to by modifying the AuthorizedKeysFile variable in the /etc/ssh/sshd_config file.

Upvotes: 1

Related Questions