It is required that your private key files are NOT accessible by others, when use SSH to connect with a Azure CentOS VM
Asked Answered
D

3

17
    WARNING: UNPROTECTED PRIVATE KEY FILE!          

Permissions for 'D:\Windows10\azure\azureuser.pem' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "D:\Windows10\azure\azureuser.pem": bad permissions [email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Demilune answered 24/12, 2021 at 2:10 Comment(3)
easily fix: copy the private key to a use folder: for example, from D:\Windows10\azure\azureuser.pem to C:\Users\username\Documents\azureuser.pemDemilune
That is a bad recommendation. The correct solution is to set the read-only attributes so that the private key is only readable by your identity. Copying a private key to the Documents folder increases the likelihood of accidental exposure.Aschim
I don't know about windows os. but whoever seeing for this issue on Linux, this command will fix it. chmod 600 ~/.ssh/id_rsa.pemBruise
P
21

Answer for Linux/Ununtu OS:

Rerun after running following command on terminal to protect your private key.

chmod 400 name-of-your-private-key-file.pem

Note: Please note, as a security mandate, it is required to protect your private-key file from other users on your local machine.

Peirce answered 14/3, 2022 at 4:11 Comment(1)
Worked for azure VMAggappora
T
4
WARNING: UNPROTECTED PRIVATE KEY FILE! 

This error indicates that the private key file is accessible by others.

The easy way to fix this is to change the permissions of the private key file.

You can navigate to the file location in the file explorer --> Right Click on the file and select properties --> Go to the security tab --> Click on Advanced -> Change the Owner to you, grant yourself full control and disable the inheritance. Also delete other permissions --> Click on apply to save the permissions

Taro answered 24/12, 2021 at 5:38 Comment(0)
O
1

I encountered a similar challenge with file permissions when dealing with the message:

Permissions for 'D:\Windows10\azure\maruti-key.pem' are too open.

Despite attempting to restrict access to the file exclusively to the intended user, the issue persisted even after employing methods such as adjusting security permissions and using "chmod" commands.

After troubleshooting, I found a solution by relocating the file to a different directory (C:/) and adjusting the file path accordingly. This simple adjustment resolved the permissions error.

Oread answered 13/2 at 9:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.