I use ssh to remote into my Ubuntu desktop.
I have set it up to use key based authentication and disabled using the password to log in.
I have also configured iptables to only allow ssh from my internal network and the IP from my work and dropped everything else for added security.
Anyways, I am only able to gain access if I am already logged in. If I remote in and reboot for any reason, I get the permission denied pubkey message and it refuses to let me in.
For kicks, I used team viewer to log into my machine. After I logged myself in via team viewer, It let me ssh into it again.
Is there a setting I may have forgot to check when editing my sshd_config file?
My home directory is encrypted if that makes any difference. This is possibly the culprit.
I originally configured everything on 16.04 but recently upgraded to 17.04. I left all configurations the same during the upgrade.
It's because ssh daemon can't access to your authorized_keys file.
USERNAME to your username.
sudo mkdir /etc/ssh/USERNAME
Copy your key
sudo cp /home/USERNAME/.ssh/authorized_keys /etc/ssh/USERNAME
sudo chown -Rf USERNAME.USERNAME /etc/ssh/USERNAME sudo chmod 644 /etc/ssh/USERNAME/authorized_keys
Add the following in