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 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: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth] Nov 22 12:17:31 ip-yy-yy-yy-yy sshd: Connection closed by authenticating user ubuntu zz.zz.zz.zz port 60931 [preauth]
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:
sudo nano /etc/ssh/sshd_config
- Add the following line and save and close the file
- Restart the server or the sshd service
service sshd restart
You should now be able to SSH to your Ubuntu instance.