OpenSSH server configuration on Windows10


  1. Posts : 5
    windows10
       #1

    OpenSSH server configuration on Windows10


    I am desperately trying to configure an openSSH-server on windows 10.
    I have followed serveral online tutorials but always get stuck with the keys.

    I have generated ssh_host_ed25519_key and ssh_host_ed25519_key.pub in C:\Windows\System32\OpenSSH.

    But when I try to start sshd the log-file shows:
    Could not load hostkey .\ssh_host_rsa_key
    .\ssh_host_dsa_key
    .\ssh_host_ed25519_key

    So I guess sshd is somehow looking in the wrong directory?

    I should add that I am a 'unix-guy' and very unfamiliar with windows.
    BTW: the Openssh-client seems to work well on windows10
      My Computer

  2. jimbo45's Avatar
    Posts : 10,455
    Windows / Linux : Arch Linux
       #2

    Hi there

    @wolfgang6444

    working perfectly for me -- I just installed the openssh server via "add optional features" started the sshd and authentication manually (windows ctrl-alt-delete and get into task manager to select services) with defaults and from Linux Host was able to login to Windows VM via SSH. I think default keys generated automatically --you can always tighten up security later -- I always test these thing initially with minimal security and then fix later.

    Just ignore any errors with those keys initially.

    To get the ed25519 keys in your User directory (windows) just use filebrowser to browse to openssh folder and simply click on the keygen.exe file -- it will import appropriate keys to your user file --now you can login from a client ssh machine.

    Easy way to test especially if you are a "Unix" type guy -- install a small Linux VM on Windows - install the ssh client and see if you can SSH to your Windows machine. Use VBOX / VMWare player (both free) - on the small linux box don't bother with GUI etc -- just base system with SSH and networking. Should take you all of 15 mins --if that !!!.

    First logon it asks if you want to accept authentication -- type yes and then it's working fine. I'm not sure from Windows to Windows but from Linux servers its working properly.

    Note my host runs openssh client and server on Arch Linux kernel 5.4.14 , VM is KVM/QEMU Windows VM running Windows 10 - latest build. On KVM/QEMU you need bridged networking to have connectivity on LAN between VM (Windows) and host

    E.G

    [email protected] ~]$ ifconfig
    br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 192.168.1.29 netmask 255.255.255.0 broadcast 192.168.1.255
    inet6 fe80::cc79:7ff:fef0:3fc prefixlen 64 scopeid 0x20<link>
    ether ce:79:07:f0:03:fc txqueuelen 1000 (Ethernet)
    RX packets 153450 bytes 107888387 (102.8 MiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 136396 bytes 34791840 (33.1 MiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    enp3s0f0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
    ether 98:f2:b3:e6:41:f8 txqueuelen 1000 (Ethernet)
    RX packets 0 bytes 0 (0.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 0 bytes 0 (0.0 B)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
    device interrupt 40

    enp3s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet6 fe80::1bbf:8f1e:2c2d:da27 prefixlen 64 scopeid 0x20<link>
    ether 98:f2:b3:e6:41:f9 txqueuelen 1000 (Ethernet)
    RX packets 198881 bytes 138177183 (131.7 MiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 153057 bytes 39444320 (37.6 MiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
    device interrupt 41

    bridge br0 is master of physcal nic enp3s0f1

    in the VM config network nic is shared device name -->bro (the bridge) and I'm using virtio as the nic driver for speed.

    Here's connection vis SSH TO Windows:

    OpenSSH server configuration on Windows10-screenshot_20200125_100610.png

    added --on the linux box you can connect to Windows via SSH andputty as well - keys can be re-genned so I'm not risking security via screenshot --besides it's only a temporary test Windows VM which I can junk at any time !!!

    OpenSSH server configuration on Windows10-screenshot_20200125_105404.png

    If you want full GUI access into your Windows box from a Linux machine you probably will need to install some type of X-server on Windows (e.g xming) or use cygwin and have some sort of X11 forwarding -- I'm not sure if bog standard things like rdesktop on a Linux box would give you SSH level of security.

    I never really need to access Windows remotely though so this is as much a test for me as you !!!!

    Cheers

    jimbo
    Last edited by jimbo45; 25 Jan 2020 at 05:03. Reason: added ssh via putty to W10 screenshot
      My Computer


  3. Posts : 5
    windows10
    Thread Starter
       #3

    @ jimbo45
    many thanks for the advice!
    I have removed the features openssh-server and opeenssh-client.
    I have erased C:\Windows\System32\OpenSSH
    I have reinstalled the optional-feature openssh-server.
    I press ctrl+alt-delete, and go to Task-Manager, services.
    I press start on sshd.
    sshd does NOT start (see attached, my Windows is German)
    \Any idea of what I might be missing?

    OpenSSH server configuration on Windows10-screenshot1.png
    OpenSSH server configuration on Windows10-screenshot2.png
      My Computer

  4. jimbo45's Avatar
    Posts : 10,455
    Windows / Linux : Arch Linux
       #4

    wolfgang6444 said:
    @ jimbo45
    many thanks for the advice!
    I have removed the features openssh-server and opeenssh-client.
    I have erased C:\Windows\System32\OpenSSH
    I have reinstalled the optional-feature openssh-server.
    I press ctrl+alt-delete, and go to Task-Manager, services.
    I press start on sshd.
    sshd does NOT start (see attached, my Windows is German)
    \Any idea of what I might be missing?

    OpenSSH server configuration on Windows10-screenshot1.png
    OpenSSH server configuration on Windows10-screenshot2.png
    Hi there

    guten Tag @wolfgang6444

    try and browse to the openssh keygen.exe file and double click --this should generate a key for you.

    OpenSSH server configuration on Windows10-screenshot_20200125_111518.png

    look at the config file too --open with notepad.

    reboot the Windows machine and then have another go at starting SSHD service -- you might also need to ensure that your user can start services --might need mucking around with secpol --this is an area of Windows though I have almost ZERO experience in.

    I added to my previous post to show how to do it via Putty and SSH (from the Linux Host) as well.

    Both ssh-agent and SSHD services need to be running (my Windows is in icelandic but it shows services running I set to manual for testing).

    OpenSSH server configuration on Windows10-screenshot_20200125_112230.png

    Cheers
    jimbo
      My Computer


  5. Posts : 5
    windows10
    Thread Starter
       #5

    @jimbo,

    Me too, I am running Windows as virtual-client via libvirt/qemu on an linux host running Centos8.
    Networking is via a virtual-bridge.
    I use xfreedrp to remotely connect to the client.
    ssh is mostly required to copy files to and from the client (scp).
    It is basically sufficient to have the client running on windows, but sometimes it is more convenient to push the files rather then pulling them.

    Wolfgang
      My Computer

  6. jimbo45's Avatar
    Posts : 10,455
    Windows / Linux : Arch Linux
       #6

    wolfgang6444 said:
    @jimbo,

    Me too, I am running Windows as virtual-client via libvirt/qemu on an linux host running Centos8.
    Networking is via a virtual-bridge.
    I use xfreedrp to remotely connect to the client.
    ssh is mostly required to copy files to and from the client (scp).
    It is basically sufficient to have the client running on windows, but sometimes it is more convenient to push the files rather then pulling them.

    Wolfgang
    Hi there
    @wolfgang6444

    what about running SAMBA on the host -- then it's easy both ways .

    For command line transfer FROM windows you could always use on the Host rsync (or for gui grsync) or even any decent ftp program once you know the file names you want to get. On the Windows HOST telnet should easily push files for you.

    For Windows laptops running on my lan (there's usually about 6 computers other than mine on my Home Lan) people backup their stuff on to their home directories on the NAS server - I don't care what they use for backup -- that's their problem how they save their data --not mine !!!!!!! -- and then once a day via crontab I rsync their homes to off line storage.

    Users can always retrieve their data from home directories at any time while the server is available.

    For remote access (outside the LAN) installing something like OPENVPN should be reasonably secure or even (WAMP / LAMP) servers (Windows/Linux, Apache,MySql (now MariaDB) PHP.

    For really simple command on Windows though what about telnet --I think Windows can act as a telnet server (you need a 3rd party app though for the server ) as well as a client --haven't tested that bit but I can certainly telnet FROM windows.

    Cheers

    jimbo
      My Computer


  7. Posts : 5
    windows10
    Thread Starter
       #7

    Sure there are alternatives,

    but to me ssh is really most straight forward and is absolute standard under linux.
    And it is supposed to be working under windows aswell - I just don't manage to make it working.

    I guess, I will keep trying.

    Many thanks anyway,

    Wolfgang
      My Computer

  8. jimbo45's Avatar
    Posts : 10,455
    Windows / Linux : Arch Linux
       #8

    wolfgang6444 said:
    Sure there are alternatives,

    but to me ssh is really most straight forward and is absolute standard under linux.
    And it is supposed to be working under windows aswell - I just don't manage to make it working.



    I guess, I will keep trying.

    Many thanks anyway,

    Wolfgang

    Hi there
    @wolfgang6444

    PLEASE don't give up !!

    If a brazened old Gas and Oil engineer like me (semi retired now) from a tiny Island near Arctic circle (Iceland) can get it working -- in spite of the fact I've seen a load of --from Germany's HUGE software company --used it myself a lot --SAP Walldorf -- consultants on around 1000 EUR a day (if only at my age !!!) who seem to be flummixed with the most simple things I'm sure you'll manage

    anyway --It's working for me --So GOOD LUCK and DON'T GIVE UP -you'll manage eventually. !!!

    Cheers
    jimbo
      My Computer


  9. Posts : 5
    windows10
    Thread Starter
       #9

    O.K.,

    It seems I got it working:

    • Do the following as administrator:
      cd to C:\Windows\System32\OpenSSH and execute ssh-keygen -A
      Install-Module -Name OpenSSHUtils -RequiredVersion 0.0.2.0 in a windows-powershell
      Download and unzip OpenSSH-Win64.zip from Release v0.0.15.0 . PowerShell/Win32-OpenSSH . GitHub
      Copy FixHostFilePermissions.ps1 to C:\Windows\System32\OpenSSH
      In a windows-powershell cd to C:\Windows\System32\OpenSSH and execute .\FixHostFilePermissions
      Now the sshd service can be started and -guess what- you can finally ssh to your windows10 computer


    Ain't this genuine pure crap ???
      My Computer

  10. jimbo45's Avatar
    Posts : 10,455
    Windows / Linux : Arch Linux
       #10

    wolfgang6444 said:
    O.K.,

    It seems I got it working:

    • Do the following as administrator:
      cd to C:\Windows\System32\OpenSSH and execute ssh-keygen -A
      Install-Module -Name OpenSSHUtils -RequiredVersion 0.0.2.0 in a windows-powershell
      Download and unzip OpenSSH-Win64.zip from Release v0.0.15.0 . PowerShell/Win32-OpenSSH . GitHub
      Copy FixHostFilePermissions.ps1 to C:\Windows\System32\OpenSSH
      In a windows-powershell cd to C:\Windows\System32\OpenSSH and execute .\FixHostFilePermissions
      Now the sshd service can be started and -guess what- you can finally ssh to your windows10 computer


    Ain't this genuine pure crap ???
    Wel done

    Now I'm in the pub for some decent sat Night Drinks.

    Cheers

    jimbo
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 20:27.
Find Us




Windows 10 Forums