Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 13 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. http://www.openbsd.org/cgi-bin/man.cgi?query=sshd_config&sektion=5

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
1  
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
1  
@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
1  
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
show 3 more comments

Your Answer

 
discard

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.