2

As the title says, when I run sshd from the command line (C:\Windows\OpenSSH\sshd.exe) my passwordless login to localhost works flawlessly, but if I run it as a service (double checked the path and it's the same as above) I get no error from the service that I can tell but connecting to it gives this error:

Connection reset by 127.0.0.1 port 22

The authentication agent isn't active either as a service or started from the command line at all, the public keys should be copied correctly (again, connecting to the command line sshd works) and OpenSSH is installed from the optional features of an up to date Windows 10 installation.

Maybe the permissions to the ssh key files are wrong? The service seems to be set to run as "local service", whatever that is, do I need to figure out the actual user name and give it full control over C:\ProgramData\ssh or something?

Here's the tail end of the fail log when trying to connect to service sshd:

debug1: Authentication succeeded (publickey).
Authenticated to localhost ([127.0.0.1]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug1: console supports the ansi parsing
debug3: Successfully set console output code page from:437 to 65001
debug3: Successfully set console input code page from:437 to 65001
debug3: recv - from CB ERROR:10054, io:0000016F1866FEE0
debug3: send packet: type 1
debug3: send - WSASend() ERROR:10054, io:0000016F1866FEE0
Connection reset by 127.0.0.1 port 22
debug3: Successfully set console output code page from 65001 to 437
debug3: Successfully set console input code page from 65001 to 437

As you can see, the authentication succeeds, then something happens and the connection is refused.

2
  • did you find a solution for the problem? please help. thanks
    – AndreyS
    Commented Nov 29, 2021 at 11:25
  • Yes, but it's been a while. If I recall correctly, the problem was with admin accounts being treated differently by SSH, there's a setting to remove that. By default, it reads admin accounts from a different public key file.
    – Blindy
    Commented Nov 29, 2021 at 16:24

1 Answer 1

-1

Error 10054 occurs when the connection is reset by the peer application, usually due to an incorrect firewall configuration.

You could try to disable the Windows Firewall momentarily to find out if this is indeed the problem.

To open port 22 in Windows Firewall, perhaps the easiest way is to run PowerShell as Administrator and enter the following command:

New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
2
  • Again, I can connect just fine to it with the same firewall settings if I run sshd from the command line.
    – Blindy
    Commented Apr 28, 2021 at 20:55
  • Try to put the service on an admin login, rather than local system.
    – harrymc
    Commented Apr 28, 2021 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .