Permissions for .pem are too open


While connecting to Azure VM via SSH came across a series of stumbling blocks and hence the series of blog posts as documentation of the learning curve. This may help others.

- November 15, 2020

Rest of the Story:

While connecting to Azure VM via SSH came across a series of stumbling blocks and hence the series of blog posts as documentation of the learning curve. This may help others.

Connecting to newly created Azure VM via SSH came across the error surrounding permissions on my pem file

PS c:\>ssh –i {pathtopemfile}.pem mailto:azureuser@{ipaddress}

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
WARNING: UNPROTECTED PRIVATE KEY FILE!          @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Permissions for '{filename}.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

You locate the file in Windows Explorer, right-click on it then select "Properties". Navigate to the "Security" tab and click "Advanced".

a) Change the owner to you

b) Disable inheritance and delete all permissions.

c) Then grant yourself "Full control"

and save the permissions.

Now SSH won't complain about file permission too open anymore.  It should look like the following

image