"Server refused our key"

“Server refused our key”

On my new Rocky 9 installation I have the same procedure as on Rocky 8. Under Rocky 8 works well but on Rocky 9 returned “Server refused our key”.

On my Putty local pc, I generate the keys and copy-paste the public key to the Rocky server.

Rocky 8 and Rocky 9
cd $HOME/
mkdir .ssh
cd .ssh
vim authorized_keys (Add public server key)
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
restorecon -R -v /root/.ssh
systemctl restart sshd

Any ideas about what I need to do on Rocky 9?

Hi @pata2004, When copying and pasting a key, you can sometimes get unintended consequences. Take a look at this post that reflects your issue and let me know if on further inspection, you find an error in the key file: ssh - Putty: Getting Server refused our key Error - Stack Overflow

Steve

What is the type of the key? RSA? How many bits?
EL9 default crypto policies require at least 2048 bits in RSA. See https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening

Upgrading Putty to 0.78 (the last version) solved the issue.

Thanks @sspencerwire, I followed your link, and lead me to another link where I found the solution.

I found the solution on openssh - SSH server gives "userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]" when connecting with Putty - Unix & Linux Stack Exchange

Thanks very much, @sspencerwire and @jlehtone for your great help