Allowing a Pem file to work on Windows 10

Well – two ways 1.) convert the .pem file to a .ppk and use puTTY here is how:

https://www.putty.org/

https://aws.amazon.com/premiumsupport/knowledge-center/convert-pem-file-into-ppk/

Of if you want to use ssh on Window with your .pem file, do the following.

Do the fix below, to set the permission correctly for the .pem to work, THEN try your SSH command at the bottom of this post – you’ll need to use a privileged user account for this (one with local admin).

fixing a pem file on windows
:: # Set Variable ::
Set Key="C:\keys\myEC2-key.pem"

:: # Remove Inheritance ::
Cmd /c Icacls %Key% /c /t /Inheritance:d

:: # Set Ownership to Owner ::
Cmd /c Icacls %Key% /c /t /Grant %UserName%:F

:: # Remove All Users, except for Owner ::
Cmd /c Icacls %Key% /c /t /Remove Administrator "Authenticated Users" BUILTIN\Administrators BUILTIN Everyone System Users

:: # Verify ::
Cmd /c Icacls %Key%

cd \keys

# then from a Windows 10 DOS command prompt

ssh -i “myEC2-key.pem” <yourEC2host>

# by the way you can obtain your actual connect string on EC2 console – look up

Leave a Comment

Scroll to Top