I have an interesting problem with ssh. Here is the setup.
My client (running Ubuntu 17.04) has public and private ssh keys. I copied over the public key to the server (running Ubuntu Server 16.04.3 LTS) using the
ssh-copy-id command. I verified this worked by looking at the authorized_keys file on the server; my client's public key is the only one listed.
Now onto the problem. I am able to login to the server from the client through ssh, using my private ssh-key. But after I logout and attempt to ssh again, I get the following error:
Permission denied (publickey).
When I login to the server at the console, I use my password to login and it works fine. Then when I try to SSH again from my client, it works again. And I can logout and login as many times as I want. As soon as I logout from the console on the server (like I'm physically at the server logged in before this), I can SSH from my client exactly ONE more time. Then as soon as that session is ended, I get the
Permission denied (publickey).error again on all subsequent SSH attempts. Any ideas?
Here is my ssh config file on my client:
Host sauron HostName 192.168.1.191 User joe PubKeyAuthentication yes IdentityFile id_rsa
One more thing to mention is I do have the entire SSD on the server encrypted. I have to unlock it whenever I boot the server with an encryption password. Not sure if that's relevant. I suspect it could be a permissions issue, though I'm not sure of that either. Suggestions would be much appreciated, and please ask if you need clarification on anything.