Score:0

ssh to server exits w/225 after reboot of Ubuntu 20.04

my flag

I rebooted Ubuntu 20.04 via an ssh session using init 6. Once it came back up, I can connect, but it fails with an exit code of 255. I've tried public key and password auth. Here is the tail end of ssh -vv 10.0.2.184 - and it shows that the authentication worked! But I can't figure out why it dies with 255...

debug1: Server accepts key: /opt/openssh-8.9p1/etc/ssh_host_rsa_key RSA SHA256:1Dt6UXfkDXMyVKjPZ56Sj3lCoyefwgP2ZG7BNJLE9uE
Authenticated to 10.0.2.184 ([10.0.2.184]:22) using "publickey".
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: client_input_hostkeys: searching /root/.ssh/known_hosts for 10.0.2.184 / (none)
debug1: client_input_hostkeys: searching /root/.ssh/known_hosts2 for 10.0.2.184 / (none)
debug1: client_input_hostkeys: hostkeys file /root/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: host key found matching a different name/address, skipping UserKnownHostsFile update
debug1: Remote: /root/.ssh/authorized_keys:15: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /root/.ssh/authorized_keys:15: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 4 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug1: channel 0: setting env LANG = "C"
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: chan_shutdown_read: channel 0: (i0 o0 sock -1 wfd 5 efd 7 [write])
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i3 o1 sock -1 wfd 6 efd 7 [write])
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
Connection to 10.0.2.184 closed.
Transferred: sent 3140, received 3232 bytes, in 0.6 seconds
Bytes per second: sent 5192.6, received 5344.7
debug1: Exit status 255

Anyone have any ideas?

in flag
The error log is saying that `/root/.ssh/known_hosts` does not exist, which raises a couple of questions: (0) are you trying to SSH as root? (1) are you using a script or automated process to SSH into the machine?
Larry R. Irwin avatar
my flag
I've tried root - for which it was working before the reboot using an rsa public key auth and it worked. I've also tried a regular user, for which it allows me to use a password since it is in a private LAN network address - and it allows me to enter the password, but drops out with th 255 error code... It is really odd..
in flag
It should not be possible to SSH into an Ubuntu machine with `root` unless you've drastically modified many of the built-in permissions and security policies. The `255` error happens when the machine's signature is not found in the `known_hosts` file. It should be possible to manually sign in with a non-`root` account and answer "Yes" to the prompt about adding the signature to `known_hosts`. After that, things should work as they did before
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.