3

I have a running ec2 instance and I was able to connect with ssh (PEM) file with ubuntu 20.04.5 LTS however it is not working after upgrading to ubuntu 22.04.1 LTS. I have not changed any settings or anything else. The auth log shows the following error

userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

Please help to resolve the issue

UPDATE

This is the notification I have on ec2

Authenticating with public key "imported-openssh-key"
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.15.0-1019-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Sep  5 13:09:50 UTC 2022

  System load:  0.0               Processes:             102
  Usage of /:   35.7% of 7.57GB   Users logged in:       0
  Memory usage: 15%               IPv4 address for ens5: IP
  Swap usage:   0%


0 updates can be applied immediately.

New release '22.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
5
  • @guiverc previous version was 20.04.5 and there was a notification to upgrade 22.04.1 so I ran do-release-upgrade, ssh stopped working after it. I have updated the questions too. Thanks.
    – Vikram
    Sep 5, 2022 at 13:12
  • @guiverc I have a clone server with same config and I have the upgrade message there as posted in the questions. Not sure how is it possible but it seems I already had 22.04.5 and also have a message to upgrade to 22.04.1. Please check update on questions.
    – Vikram
    Sep 5, 2022 at 13:17
  • Thanks for poiting out, I overlooked in panic. My bad
    – Vikram
    Sep 5, 2022 at 13:20
  • Is there any way to fix it. I am not able to access the server anymore.
    – Vikram
    Sep 5, 2022 at 13:20
  • I noticed one strange thing. I am able to connect with ppk file via FTP or putty but pem file is not working for DB connection.
    – Vikram
    Sep 5, 2022 at 13:30

1 Answer 1

3

Put the following in your /etc/ssh/ssh_config:

PubkeyAcceptedKeyTypes +ssh-rsa
HostKeyAlgorithms +ssh-rsa

This will allow the SSH client to connect using the deprecated algorithms.

Also see here and here.

3
  • What about next upgrades, these changes will be either lost or the support will be removed completely as they are already deprecate ? Will I have to create new key pair ?
    – Vikram
    Sep 6, 2022 at 10:02
  • 1
    Nobody can predict the future.. Sep 6, 2022 at 10:06
  • 1
    thats right, but can I add a new file under ssh_config.d to avoid such case ? I am not pro with ubuntu or ssh and really appreciate your help.
    – Vikram
    Sep 6, 2022 at 10:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .