Ubuntu – Can not log into SSH unless logged in locally


I just set up pubkey authentication on my server (running ubuntu server 10.10). If I am logged in to the server locally (at the box), then I can ssh into the server fine (from another machine). If I am not, however, I can not login and just receive the error "Permission denied (publickey)".

If I run the ssh command with the verbose flag, this is the output: http://pastebin.com/3bPaTe1u

I do not have this issue if I don't use pubkey authentication and just use password-based, but pubkey is the method I would like to use.

Any help?

Best Answer

I'm going to assume your home directory is encrypted - in this case it is only decrypted when you log in - so when you are trying to authenticate you are not yet logged in so your home directory is not decrypted and hence as suggested above the ssh daemon can't read authorized keys file. You can fix this by following the instructions here.