The error message “userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]” indicates that the SSH server is configured to accept specific public key algorithms, and the client attempted to use the “ssh-rsa” algorithm, which is not included in the accepted algorithms list.
To resolve this issue, you have a few options:
Update SSH Key Algorithm: If you are generating a new key pair, consider using a more secure algorithm such as Ed25519 instead of the older RSA algorithm.
Update Server Configuration: If you don’t have control over the client’s key type, you may need to update the server’s SSH configuration to include support for the “ssh-rsa” algorithm. Open the SSH server configuration file (usually located at /etc/ssh/sshd_config), and add or modify the following line:
1
PubkeyAcceptedAlgorithms +ssh-rsa
After making the change, restart the SSH server.
1
sudo service ssh restart
Note: Adding “ssh-rsa” might reduce the security of your SSH server, as RSA is considered less secure than some newer algorithms.
Check Key Types: Ensure that you are using the correct key type when attempting to authenticate. If you are using an existing key, make sure it’s the right type (e.g., Ed25519) and not RSA.
Choose the option that best fits your security requirements and constraints. If possible, it’s generally recommended to use more modern and secure key algorithms like Ed25519 over older ones like RSA.