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.
- Copy the public and private keys to
%userprofile%\.ssh
- Use the batch script below after finding your keys from the cmd prompt with
where *.pub
:Md %Userprofile%\.ssh Copy PublicKey %Userprofile%\.ssh Copy PrivateKey %Userprofile%\.ssh Cd %Userprofile%\.ssh Icacls .\PublicKey /Inheritance:r Icacls .\PrivateKey /Inheritance:r Icacls .\PublicKey /Grant:r "%Username%":"(F)" Icacls .\PrivateKey /Grant:r "%Username%":"(F)"
- Right-click each file → Properties → Security:
Remove everyone except the user, setting the permissions for the user to Read