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

openssh-win64
openssh windows 7
openssh github
windows 10 ssh config
install openssh windows server 2012
openssh linux
openssh sftp
openssh server

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

Installation of OpenSSH For Windows, Uninstall Win32 OpenSSH. Start Windows Powershell as Administrator; Navigate to the OpenSSH directory. cd 'C:\Program Files\OpenSSH'. OpenSSH is the open-source version of the Secure Shell (SSH) tools used by administrators of Linux and other non-Windows for cross-platform management of remote systems. OpenSSH has been added to Windows as of autumn 2018, and is included in Windows 10 and Windows Server 2019.

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

Installing SFTP/SSH Server on Windows using OpenSSH :: WinSCP, As of Nov 1st 2016, active development on "Windows for OpenSSH" is being done in https://github.com/PowerShell/openssh-portable. This repo  For Windows OpenSSH, the only available authentication methods are "password" and "publickey". AuthorizedKeysFile. The default is ".ssh/authorized_keys .ssh/authorized_keys2". If the path is not absolute, it is taken relative to user's home directory (or profile image path). Ex. c:\users\user.

You have to do this from an cmd prompt as powershell messes up the ProgramData variable.

Do this

C:\Program Files\OpenSSH-Win64>powershell .\install-sshd.ps1 -A

from a command prompt and you will probably be good to go.

OpenSSH, Microsoft announced it was bringing an integrated OpenSSH client to Windows in 2015. They've finally done it, and an SSH client is hidden in  On Windows 10 version 1803 and newer In Settings app, go to Apps > Apps & features > Manage optional features. Locate “OpenSSH server” feature, expand it, and select Install. Binaries are installed to %WINDIR%\System32\OpenSSH.

If you want, you can run it as administrator. This will give ssh-keygen.exe all the rights it needs to create files on its own.

runas.exe /noprofile /user:Administrator .\ssh-keygen.exe

This will install the keys under C:\Users\Administrator.ssh

If you want the keys to be accessible to your current user or another user just run Powershell as that user by right clicking on it and clicking Run as Different User.

You do not want to be in an elevated Powershell when you generate keys

OpenSSH runs from the current user and checks their C:\Users\UserName.ssh. Similar to how SSH works in Linux.

Install Win32 OpenSSH · PowerShell/Win32-OpenSSH Wiki · GitHub, Download OpenSSH for Windows for free. THIS PROJECT IS DISCONTINUED. An installer for a minimal installation of the Cygwin environment suitable for  The OpenSSH tools include scp, which is a secure file-transfer utility, to help with this. To move the contents of your public key (~.ssh\id_ed25519.pub) into a text file called authorized_keys in ~.ssh\ on your server/host.

PowerShell/Win32-OpenSSH: Win32 port of OpenSSH, Secure Shell (ssh) is a standard tool included on most "network" operating systems i.e. Linux, UNIX, MacOS, etc.. In the past Windows required a  The Windows Server documentation has a section titled "OpenSSH in Windows" The normal suite of of functions are included with the Windows 10 port, ssh.exe, which is the SSH client used from the user's local system sshd.exe, which is the SSH server that accept connections from other systems

How to Enable and Use Windows 10's New Built-in SSH Commands, Windows servers require an SSH server to be installed to allow secure remote login, secure file transfers, and automated remote command execution. There are​  OpenSSH for Windows Web Site Other Useful Business Software Built to the highest standards of security and performance, so you can be confident that your data — and your customers’ data — is always safe.

OpenSSH for Windows download, Let's see how to enable the OpenSSH server in Windows 10. Enable the OpenSSH Server in Windows 10. Open the Settings app and go to Apps -> Apps & features. On the right, click Manage optional features. On the next page, click the button Add a feature. In the list of features, select OpenSSH Server and click on the Install button. Restart Windows 10.

Comments
  • that did it for me.
  • This fixed my issue when I was trying it on Windows Server 2012R2, thanks! :)