After getting disconnected from the server (Ubuntu 18.04.1) I can not login anymore using public key.
I have 2 accounts that can run sudo. One account uses public key and a passphrase to login, and the other uses a password. Both accounts have existed for a long time and worked flawlessly. Now I have got a problem with the account that uses public key. When I try to login, i always get a question about passphrase, but that question is gone, and I get : "Permission denied (publickey)" without ssh asking for a passphrase. I have tried rebooting my client, but that does not help. I have rebooted my server and that does not help either. What helps, is if I use the other account (User2) that uses a password instead of a key and login to the server and disable the following rows in my sshd_config and and run "sudo service ssh restart":
#Match User User1 #PasswordAuthentication no
Then logout and run ssh email@example.com. Now I will be asked for a password and not a passphrase and then I will be logged in. If I then change the ssd_config back to
Match User User1 PasswordAuthentication no
and and run "sudo service ssh restart"
I will be able to use user1 to login and I will be prompted for a passphrase, so everything works.
This will work fine until the connection disconnects due to inactivity or i reboot my server (which will generate a disconnect). After that I have to repeat all steps above.
I have tried connecting from two different clients, one running Linux Mint and the other raspbian, the problem is the same.
I have also tried ssh -i .ssh/id_rsa firstname.lastname@example.org and the result is the same "Permission denied (publickey)"