Skip to main content

I am using Windows 10 built-in OpenSSH. I copied my public and private keys to %userprofile%\.ssh

I wrote a small batch script for my users to use after they find their keys from the cmd prompt with: where *.pub

Rem You must replace PublicKeyFilename and PrivateKeyFilename with actual file names.

md %userprofile%\.ssh
copy PublicKeyFilename %userprofile%\.ssh
copy PrivateKeyFilename %userprofile%\.ssh
cd %userprofile%\.ssh
icacls .\PublicKeyFilename /inheritance:r
icacls .\PrivateKeyFilename /inheritance:r
icacls .\PublicKeyFilename /grant:r "%username%":"(F)"
icacls .\PrivateKeyFilename /grant:r "%username%":"(F)"

The final step was right-clicking the file, Properties, Security, and editing the permissions to remove everyone except my username and setting the permissions for myself to Read.