Can't Get Host Key for Local OpenSSH Server

Advertisement

aksarben
Joined:
Posts:
72

Can't Get Host Key for Local OpenSSH Server

I successfully installed & started the OpenSSH server on my PC. I plan to use it for testing/debugging a custom SFTP client.

I followed the steps at https://winscp.net/eng/docs/guide_windows_openssh_server#win10 for "Installing SFTP/SSH server on Windows Using OpenSSH." Things went OK until I reached the step "Finding Host Key." I ran the specified command and got the following error messages:
C:\Users\Dick>for %f in (%ProgramData%\ssh\ssh_host_*_key) do @%WINDIR%\System32\OpenSSH\ssh-keygen.exe -l -f "%f"
ssh-keygen: C:\\ProgramData\\ssh\\ssh_host_dsa_key: Permission denied
ssh-keygen: C:\\ProgramData\\ssh\\ssh_host_ecdsa_key: Permission denied
ssh-keygen: C:\\ProgramData\\ssh\\ssh_host_ed25519_key: Permission denied
ssh-keygen: C:\\ProgramData\\ssh\\ssh_host_rsa_key: Permission denied
I didn't see anything in the instructions on how to set the permissions for these files, though my Windows account DOES have administrator access.

Any help on getting past this step would be greatly appreciated.

My system:
WinSCP Version: 6.1 (Build 13674 2023-5-23)
Microsoft Windows Version: Windows 10 Home, version 22HS, OS build 19045.2965, Windows Feature Experience Pack 1000.19041.1000.0

Reply with quote

Advertisement

aksarben
Joined:
Posts:
72

Solved the Problem

It occurred to me that file permissions might be the problem. So I closed the command interpreter window, then re-opened it as an administrator, and ran the command again.

This time it worked as advertised.

Thanks for your patience (and documentation!)

Dick Adams
http://www.hymntime.com/tch/

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Can't Get Host Key for Local OpenSSH Server

Thanks for your feedback. I've updated the documentation to explicitly mention that Administrator permissions are needed.

Reply with quote

Advertisement

You can post new topics in this forum