Can’t SSH on Upgraded Ubuntu 22.04

Can’t SSH on Upgraded Ubuntu 22.04
Can’t SSH on Upgraded Ubuntu 22.04

How to Enable SSH on Upgraded Ubuntu 22.04

Just recently I upgraded a 'test' server I have on AWS from Unbuntu v 18 to v 22.04, and the first problem I hit upon was that I couldn't SSH on to the upgraded Ubuntu 22.04 server via Solar-Putty (this also affects connections from Putty). Incidentally I can still connect via SSH on a Windows machine via the command prompt.

The Reason

The reason I can't connect via SSH on the upgraded Ubuntu 20.04 server is because due to an updated version of the openssh-server package in Ubuntu 20.04. Newer versions do not support the "ssh-rsa" algorithm, details of which can be found in these release notes.

When you check your SSH logs you will see this error:

# tail -f /var/log/auth.log
Nov 22 12:17:31 ip-yy-yy-yy-yy sshd[15652]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Nov 22 12:17:31 ip-yy-yy-yy-yy sshd[15652]: Connection closed by authenticating user ubuntu zz.zz.zz.zz port 60931 [preauth]

The Solution

The first thing you will need to do is connect to your machine via SSH. Do this via either the the command prompt on a Windows machine or via the Terminal on an Apple Mac.

Other options for connecting are EC2 Instance connect & EC2 Serial Console.

If for any reason you can't connect via SSH on these methods then this article has a method using Docker.

Once you've connected to your server do the following:

  1. Run
    sudo nano /etc/ssh/sshd_config
  2. Add the following line and save and close the file
    PubkeyAcceptedAlgorithms +ssh-rsa
  3. Restart the server or the sshd service
    service sshd restart

You should now be able to SSH to your Ubuntu instance.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.