I have set up the sshd server in windows 11 as in the official documentation. I have transfered my public key to the windows machine to C:\ProgramData\ssh\ as administrators_authorized_keys and changed the permission like it is written in the documentation:
Get the public key file generated previously on your client$authorizedKey = Get-Content -Path $env:USERPROFILE.ssh\id_ed25519.pub
Generate the PowerShell to be run remotely that will copy the public key file generated previously on your client to the authorized_keys file on your server
Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value "$authorizedKey"; icacls.exe "$env:ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrator:F" /grant "SYSTEM:F"
Also I have uncommented the sshd_config file line in C:\ProgramData\ssh\ and set to PubkeyAuthentication yes
still I can´t connect. It is hanging for about 2 seconds then the connection breaks with the error: Connection reset by 192.168.2.132 port 22
this is the output of the debug message:
debug1: rekey out after 134217728 blocksdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: rekey in after 134217728 blocksdebug1: SSH2_MSG_EXT_INFO receiveddebug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>debug1: SSH2_MSG_SERVICE_ACCEPT receivedlsConnection reset by 192.168.2.132 port 22