Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, March 21, 2019 7:03 AM
Goal: I'm trying to set up the Windows built-in OpenSSH server (version 0.0.1.0, as I recall that being the latest one) in order to use my desktop PC remotely should I have the need for raw performance when on the road through a Windows 10 laptop.
Problem: Despite following the official guide (https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse) to the letter, when I try to run "Start-Service sshd" in PowerShell I get this error:
Start-Service : Service 'OpenSSH SSH Server (sshd)' cannot be started due to the following error: Palvelun sshd avaamin
en tietokoneessa . epäonnistui.
At line:1 char:1
+ Start-Service sshd
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
ServiceCommandException
+ FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
If I run the executable without "Start-Service", however, it runs and seemingly waits for connections, but according to the Services tab in Task Manager it's not actually doing anything at all, nor is there an SSH user account associated with it.
What I've tried:
- Restarting Windows (after every installation)
- Uninstalling and re-installing both the server and the client (both from PowerShell and through the Settings application)
- Switched to local account instead of a Microsoft account (suggested on a forum thread, tried the previous steps again)
- Using an elevated PowerShell instance with admin rights
System information:
- Windows 10 Home, version 1809, build 17763.379
- Hardware configuration:
- CPU: i9-9900k @ 4.9GHz
- RAM: 32GB 3200MHz DDR4
- GPU: Asus ROG Strix GTX 1080
- Motherboard: Asus PRIME Z390-A, BIOS version 0805
Let me know if other information is required.
All replies (8)
Monday, March 25, 2019 8:31 PM
From an admin command or powershell prompt run compmgmt.msc. Check to see if the service is running, if not, start it. If it fails to start check the system eventlog for errors.
Then check the OpenSSH eventlog for errors. We'll go from there.
Tuesday, March 26, 2019 12:19 PM
Thank you for the reply!
I checked the logs as you instructed, but because my account hasn't been verified yet I can't post screenshots. Therefore, I hope that code blocks are enough.
System eventlog (XML, because it's independent of the system language and I'm not using English):
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Service Control Manager" Guid="{555908d1-a6d7-4695-8e1e-26931d2012f4}" EventSourceName="Service Control Manager" />
<EventID Qualifiers="49152">7034</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8080000000000000</Keywords>
<TimeCreated SystemTime="2019-03-26T12:00:41.737194000Z" />
<EventRecordID>7595</EventRecordID>
<Correlation />
<Execution ProcessID="920" ThreadID="2952" />
<Channel>System</Channel>
<Computer>DESKTOP-DS5GCM4</Computer>
<Security />
</System>
- <EventData>
<Data Name="param1">OpenSSH SSH Server</Data>
<Data Name="param2">1</Data>
<Binary>73007300680064000000</Binary>
</EventData>
</Event>
OpenSSH operational eventlog:
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="OpenSSH" Guid="{c4b57d35-0636-4bc3-a262-370f249f9802}" />
<EventID>4</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x4000000000000000</Keywords>
<TimeCreated SystemTime="2019-03-17T09:51:11.143042500Z" />
<EventRecordID>2</EventRecordID>
<Correlation />
<Execution ProcessID="7208" ThreadID="2044" />
<Channel>OpenSSH/Operational</Channel>
<Computer>DESKTOP-DS5GCM4</Computer>
<Security UserID="S-1-5-21-87851721-438429374-1812612-1001" />
</System>
- <EventData>
<Data Name="process">sshd</Data>
<Data Name="payload">Server listening on 0.0.0.0 port 22.</Data>
</EventData>
</Event>
Tuesday, March 26, 2019 12:45 PM
Looks like it started. Open a command prompt and run "ssh *YourAccountName*@DESKTOP-DS5GCM4".
Tuesday, March 26, 2019 1:02 PM
I opened up two PowerShell instances, and typed 'sshd' in one to start the server. Here's the input/output of the other one:
PS C:\Windows\system32> ssh dia@DESKTOP-DS5GCM4
The authenticity of host 'desktop-ds5gcm4 (fe80::7926:36de:d5c6:91d3%12)' can't be established.
ECDSA key fingerprint is SHA256:5rUB9PdcS+80trjdUOmixJFMbq+Ps/oQsa0adbQQfpo.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'desktop-ds5gcm4,fe80::7926:36de:d5c6:91d3%12' (ECDSA) to the list of known hosts.
dia@desktop-ds5gcm4's password:
Connection reset by fe80::7926:36de:d5c6:91d3%12 port 22
EDIT: If I try this without first running sshd, I just get the error
ssh: connect to host desktop-ds5gcm4 port 22: Connection refused
Tuesday, March 26, 2019 2:31 PM
Don't run sshd. You want to get the service running. Open an admin powershell prompt and run:
notepad C:\ProgramData\ssh\sshd_config
Find the "# Logging" section and add in these 2 lines.
SyslogFacility LOCAL0
LogLevel DEBUG3
Run services.msc and restart the service if its running, or start it if it's stopped. Make sure it is set to run as the system account.
If the service starts, try to connect with the ssh client.
Back to Powershell run: notepad C:\ProgramData\ssh\logs\sshd
It should look something like this:
3224 2019-03-26 07:24:00.713 debug2: fd 3 setting O_NONBLOCK
3224 2019-03-26 07:24:00.713 debug3: sock_set_v6only: set socket 3 IPV6_V6ONLY
3224 2019-03-26 07:24:00.713 debug1: Bind to port 22 on ::.
3224 2019-03-26 07:24:00.713 Server listening on :: port 22.
3224 2019-03-26 07:24:00.713 debug2: fd 4 setting O_NONBLOCK
3224 2019-03-26 07:24:00.713 debug1: Bind to port 22 on 0.0.0.0.
3224 2019-03-26 07:24:00.713 Server listening on 0.0.0.0 port 22.
3224 2019-03-26 07:26:03.541 debug3: fd 5 is not O_NONBLOCK
3224 2019-03-26 07:26:03.556 debug3: spawning "C:\\Windows\\System32\\OpenSSH\\sshd.exe" "-R"
3224 2019-03-26 07:26:03.587 debug3: send_rexec_state: entering fd = 8 config len 212
3224 2019-03-26 07:26:03.587 debug3: ssh_msg_send: type 0
3224 2019-03-26 07:26:03.587 debug3: send_rexec_state: done
184 2019-03-26 07:26:03.853 debug1: inetd sockets after dupping: 3, 3
184 2019-03-26 07:26:03.853 Connection from 192.168.1.9 port 2337 on 192.168.1.4 port 22
184 2019-03-26 07:26:03.853 debug1: Client protocol version 2.0; client software version OpenSSH_for_Windows_7.7
184 2019-03-26 07:26:03.853 debug1: match: OpenSSH_for_Windows_7.7 pat OpenSSH* compat 0x04000000
184 2019-03-26 07:26:03.853 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
184 2019-03-26 07:26:03.853 debug2: fd 3 setting O_NONBLOCK
184 2019-03-26 07:26:04.104 debug3: spawning "C:\\Windows\\System32\\OpenSSH\\sshd.exe" "-y"
Wednesday, March 27, 2019 8:05 AM
I configured the logging as instructed and tried to run the service, but unfortunately it crashes with an error code 1067. ("Process was unexpectedly closed", or something along those lines.) I checked if any logs had been made, but C:\ProgramData\ssh\logs\ is empty.
Wednesday, March 27, 2019 1:12 PM
Well I guess that starting over is the best option. Uninstall both the OpenSSH client and server and reboot. Then check that these 2 folders are either empty or no longer exist. I had to manually delete the programdata\ssh folder.
C:\ProgramData\ssh\
C:\Windows\System32\OpenSSH\
Also verify that no OpenSSH services exist.
Then reinstall the client and server from optional features. Wait until both services re defined. Then start the sshd service.
PS C:\Windows\system32> get-service -name *ssh*
Status Name DisplayName
Stopped ssh-agent OpenSSH Authentication Agent
Stopped sshd OpenSSH SSH Server
PS C:\Windows\system32> Start-Service sshd
PS C:\Windows\system32> get-service -name *ssh*
Status Name DisplayName
Stopped ssh-agent OpenSSH Authentication Agent
Running sshd OpenSSH SSH Server
Next open an admin command prompt, NOT a Powershell prompt. Run "ssh youruser@yourmachine". You will get 2 prompts, just reply yes. You should then be connected.
Tuesday, April 16, 2019 9:54 AM
I think I finally got it working! Thank you for all your help!