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 followed this description setting up a git remote git repo. This worked pretty well so far, but only when I use root@mygitserver.com:/gituserhomedir/someproject.git. When I switch to user git@... like the manual suggests I am facing a password prompt again.

I have also found this post containing lots of advice concerning chmod etc, but still can't get it to go. The strange thing to me is that I face password with the git user and a working thing as root. Any idea what's going wrong? I would really like to user a git user only dedicated to do git things (also that git shell is neat).

EDIT: Here's a rough outline of what I've done so far:

# remote machine, being root
adduser git
su git
cd 
mkdir .ssh

# on local machine
cat mykey_rsa.pub | pbcopy

# on remote (as user git), pasted clipboard to file..
vim ~/authorized_keys

I have done the same thing with the root user, adding a pubkey to the roots .ssh folder. This does work, it's only that for other users than root (with other homedirs) such as @git I cannot get a connection. I also checked the sshd_config and set the corresponding coefficients to yes.

EDIT2: Upon request, here's the output of ssh -v:

OpenSSH_5.6p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /Users/hans0l0/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to myserver.com [xx.yy.zz.202] port 22.
debug1: Connection established.
debug1: identity file /Users/hans0l0/.ssh/hans_rsa.pub type 1
debug1: identity file /Users/hans0l0/.ssh/hans_rsa.pub-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'myserver.com' is known and matches the RSA host key.
debug1: Found key in /Users/hans0l0/.ssh/known_hosts:4
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-   mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/hans0l0/.ssh/hans_rsa.pub
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering RSA public key: /Users/hans0l0/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: password
share|improve this question
    
Is it possible you could summarize, in relative detail, what you've done so far? There is not enough currently to avoid questions like: do you have a git user on the remote system? Does the user have a valid password? –  evilensky Sep 18 '13 at 21:53
    
Please post the output of ssh -v git@mygitserver.com. –  200_success Sep 19 '13 at 2:12
    
@200_success, thanks. This is indeed very telling. At the you can see that the procedure just uses a second rsa pair (id_rsa). Why? How can I prevent this. Is not suprising that I can't login because this second key is not in the authorized keys of the git user... –  hans0l0 Sep 19 '13 at 8:41
1  
Check the sshd or secure log (usually /var/log/) for clues. Common issues are incorrect permissions on ~/.ssh/ and ~/.ssh/authorized_keys. Is your key file really called my_key? You're going to want to explicitly specify it in your command with ssh -i [path/to/mykey]. Most modern open-ssh distributions have ssh-copy-id, a script which helps set proper permissions on target systems. If you are on Mac, it is available with Homebrew. –  evilensky Sep 19 '13 at 13:26
    
independently of git push etc. I get the same password prompt if I ssh -i ~/.ssh/my_rsa git@myserver.com . When I change to root@ i can immediately log in. –  hans0l0 Sep 19 '13 at 13:42

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.