I installed Ubuntu LTS 14.04 server edition on a remote computer, and added my local public key to ~/.ssh/authorized_keys on the remote computer. I found that I still needed to use password to log in the remote computer, even after setting the permission of ~/.ssh to 700, and ~/.ssh/* to 600 on the remote computer. However, once I log in, I can start using public key for authorization for other ssh sessions.My home directory is encrypted.How can I fix this?
SSH public keys not working; my home directory is encrypted
ssh;home;ecryptfs;public key authentication
Here is the solution from the link I posted in my comment. This comes from here, which references this superuser post.Create .ssh folder in /home for the keys to be storedsudo mkdir /home/.sshMove existing authorized_keys file into .ssh dir as usernamesudo mv ~/.ssh/authorized_keys /home/.ssh/usernameCreate symbolic link to authorized_keys file in user .ssh dirln -s /home/.ssh/username ~/.ssh/authorized_keysUpdate sshd_config file to set the new path for the authorized_keys filesudo vim /etc/ssh/sshd_configChange the AuthorizedKeysFile line to:AuthorizedKeysFile      /home/.ssh/%uReboot the computersudo shutdown -r nowLogin to your server and you should be presented with a minimal un-decrypted home directory... You will need to create and edit a .profile file in there to get ecryptfs to mount your home directory.sudo vim ~/.profileAdd these lines:ecryptfs-mount-privatecd /home/usernameLog out/Restart, and go back in again. You should be prompted for your password after SSH key auth, and then be presented with your decrypted home directory.You should now be able to login using SSH keys every time, no matter if your home dir is decrypted or not.