Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got an ubuntu desktop within a VirtualBox machine and I've got a strange behaviour with the openssh server :

  • when my user is not already connected to the server (first ssh connexion), it prompts for password even though privates keys are availiable (PuTTY + Pagent). After that first connection, if I open a secondary or a third connection it gets connected with the keys.
  • If I close all connections and open a new one it prompts for the password.
  • If I have let say 4 open connections and I close the first one (the one that prompted for the password), the fifth connection will be opened with the keys

Anybody already seen this ?

Thanks for the time spent helping

share|improve this question
up vote 14 down vote accepted

How is the user's home directory mounted? It sounds like, for whatever reason, the user's home directory is not available if the user is not logged in, so that sshd can't find the authorized_keys file.

Also, take a look at /var/log/auth.log on the server for any messages.

Update: if it's necessary to do password-less login, you can change the sshd_config file to look for authorzied_keys in a non-encrypted directory.

I suppose something like this would work (not tested):

AuthorizedKeysFile /etc/ssh/pubkeys/%u/authorized_keys .ssh/authorized_keys

That should tell sshd to check for public keys in both the unencrypted location and the encrypted one. Check the man page for more info.

share|improve this answer
Good idea !! I think the user dir is encrypted so this could be it! – Cerber Sep 13 '11 at 11:21
The user's home directory must be using ecrypt or something like that. – kzh Sep 13 '11 at 11:24
Ah, that'd be the cause, then, since sshd can't decrypt the contents of the home directory. – cjc Sep 13 '11 at 11:25
@kzh: yup, was burnt by that once with Ubuntu Desktop. Asks if you want to encrypt the home directory (why not?) without mentioning ssh. I should've put two and two together, but a simple "note: this will effect SSH..." would've been helpful. – gravyface Sep 13 '11 at 11:57
If you don't enter your password, how will your home directory be decrypted when you log in? – Random832 Sep 13 '11 at 16:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.