2

I am working on getting headless Raspberry Pi running Ubuntu Server 25.04. I haven't done this in a while and... passwords are no longer a thing, which is frustrating, but understandable.

I have generated the pub key on Ubuntu and have copied it over to my Windows machine. I want to simply use Windows' built-in ssh to connect. I would love to know why the Windows machine is resetting my connection, not the Linux machine.

Some highlights from the Log:

debug1: Host '(censored)' is known and matches the ED25519 host key.
debug1: Found key in C:\\Users\\(censored)/.ssh/known_hosts:1

debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received

debug1: Will attempt key: authorized_keys ED25519 SHA256: (censored) explicit
debug1: SSH2_MSG_EXT_INFO received

debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: authorized_keys ED25519 SHA256:(censored) explicit
debug1: Server accepts key: authorized_keys ED25519 SHA256: (censored) explicit

Load key "authorized_keys": invalid format

debug1: No more authentication methods to try.

(censored): Permission denied (publickey).

Looking at the logs on the Linux machine:

sshd-session[*]: Connection reset by authenticating user (username) (IP) port 50028 [preauth]

Still, I would love to know why PasswordAuthentication yes in /etc/ssh/ssh_config doesn't work in this situation.

Some Troubleshooting

Killed the known_servers on both sides to remove any residue.

I have run the ssh commands locally to the linux machine to verify that the .pub file that I pushed into authorized_keys was working correctly.

I've made sure to use a "Linux friendly" text editor for Linux CR/LF, just in case that was a problem on the Window's side. However, I haven't changed permissions for the file.

Looked for ways to pass authorization_keys on the Windows side to ssh, and it appears to have worked, but it is still complaining that the authorization_keys file is an invalid format. (Yet it reads it and pulls out the appropriate key?)

I'd like to avoid installing OpenSSH, but ... if that's the answer, I guess that's where I'll have to go.

Much appreciated.

3
  • 1
    "I have generated the pub key on Ubuntu and have copied it over to my Windows machine" - AFAIK the ssh client (Windows) needs the private key, the public key goes in the remote server's authorized_keys file Commented Aug 13 at 19:57
  • 1
    And... yup! After a bit more effort, that was exactly it. The private key needed to be there... the authorized_keys was where the .pub needed to be. Thank you! Commented Aug 13 at 21:48
  • 1
    And BTW the Windows (10 up) 'builtin' ssh IS a port of OpenSSH Commented Aug 14 at 1:16

1 Answer 1

1

As steeldriver stated, I needed to have the Private key on the Windows side. The reason it kept working locally on the Raspberry Pi was because both files were in there. A classic "works on my machine" situation. :D

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Aug 13 at 22:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.