I am trying to install OpenSSH on a Windows Server (2012 R2 standard) and I have been following the instructions at this locataion: https://www.server-world.info/en/note?os=Windows_Server_2012&p=openssh
I ran Powershell as Administrator and all seems to install correctly up to the part where I try to generate the SSH host-key by running the command .\ssh-keygen.exe -A (step 7 of the instructions).
After running this it returns an error saying:
RSA Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_rsa_key.9uX3wf3apv: No Such file of directory"
The same error also displays for DSA, ECDSA and ED25519.

If anyone can tell me where I am going wrong here it would be appreciated. I've searched the web and not found any other references to this.
The __PROGRAMDATA__ refers to your environment variable PROGRAMDATA (Which probably is set to C:\ProgramData).
It is usually easiest to open an cmd command prompt and type
mkdir %PROGRAMDATA%\ssh
or powershell
mkdir $env:ProgramData\ssh
and then rerun the
.\ssh-keygen.exe -A
I got the same error but when I manually added a folder under programdata called SSH and then ran the command again it seemed to work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With