Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenSSH on Windows - "XXX Could not save your public key in __PROGRAMDATA__

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.

Screenshot of errors

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.

like image 707
Evvy73 Avatar asked Sep 07 '25 12:09

Evvy73


2 Answers

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
like image 85
Anthon Avatar answered Sep 09 '25 13:09

Anthon


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

like image 20
Scott Coats Avatar answered Sep 09 '25 13:09

Scott Coats