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?
Best Answer
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 storedMove existing authorized_keys file into
.ssh
dir as usernameCreate symbolic link to authorized_keys file in user
.ssh
dirUpdate
sshd_config
file to set the new path for theauthorized_keys
fileChange the
AuthorizedKeysFile
line to:Reboot the computer
Login 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.Add these lines:
Log 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.