If you use the default configuration from the example, your client needs to send a ed25519 key. Might it be that you were trying to use a rsa key? You can generate a ed25519 keypair using the following command:
ssh-keygen -t ed25519 -C "your@mail"
Then call your server with the following:
ssh -i ~/.ssh/id_ed25519 -o "UserKnownHostsFile=/dev/null" -o PreferredAuthentications=publickey -o StrictHostKeyChecking=no localhost -p 2222
(of course you need to adapt the path to your key if you stored it somewhere different.)
Hello, I’ve copy pasted the server example from https://docs.rs/thrussh/0.33.5/thrussh/index.html and tried SSHing. However I always get permission denied when using public key. I’ve added debug print to
auth_publickey
method and it never gets called. Howeverauth_password
works properly. Am I missing something? Public key authorization is enabled because ssh returns error:Permission denied (publickey).
.Log:
Thank you.