Search code examples
mercurialsshdebianssh-keysmercurial-server

mercurial-server: Password is asked for ssh


I'm trying to manage my mercurial repos on my server (Debian Lenny) with mercurial-server from LShift. I was using this tutorial: http://kurtgrandis.com/blog/2010/03/20/gitosis-for-mercurial/

But when I try to clone the hgadmin repo, ssh asks me for a password.

hg clone ssh://hg@MyMercurialServer/hgadmin

But I never had set a password for the hg user. It was created using the apt-get installation. Normally, the authentication should be done with my public ssh key (which was copied to the keys/root directory from mercurial-server). But it seems, that mercurial-server don't uses my public key. I also flushed the privileges with

sudo -u hg /usr/share/mercurial-server/refresh-auth

After copying the public key to the mercurial-server keys/root dir. Furthermore, I can't find any logfiles for mercurial-server. Does anybody know, how to fix that?

Thanks.


Solution

  • zerkms, is correct -- debug the ssh directly first. Try something like:

    ssh -v -v hg@MyMercurialServer
    

    That'll let you know if your key is being sent and rejected or not sent. Also try adding -i path/to/private/key on the client to force sending the key.

    The usual config problem in ssh key setups is permissions on the authorized_keys file on the ssh server side. It needs to be 0600 and the directory its in needs to be 0700. You can debug that stuff in /var/log/messages on the server side, where sshd will print a message if it's unwilling to trust the authorized_keys file due to permissions.