maumercado
maumercado

Reputation: 1473

Gitosis publickey permission denied

I have a gitosis server at work, and I also use github for personal projects, Im trying to use the same public and private ssh keys for both accounts, the only difference would be the username which in gitosis is md.mercado49 and in github is maumercado.

I already uploaded my public key on to gitosis and of course Ive had it for some time on github, now the problem is I have permission denied when trying to connect to the gitosis server, but its successful when connecting to github with the same key.

Heres what I get with the ssh -vT [email protected] command:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to repocomit.virtual.uniandes.edu.co [157.253.238.144] port 22.
debug1: Connection established.
debug1: identity file /Users/maumercado/.ssh/id_rsa type 1
debug1: identity file /Users/maumercado/.ssh/id_rsa-cert type -1
debug1: identity file /Users/maumercado/.ssh/id_dsa type -1
debug1: identity file /Users/maumercado/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 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 'repocomit.virtual.uniandes.edu.co' is known and matches the RSA host key.
debug1: Found key in /Users/maumercado/.ssh/known_hosts:1
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
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/maumercado/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/maumercado/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

Is it even possible to do what Im trying to do, authenticate with the same key and different usernames and emails?

Should I generate a different key for the other account, if so, how?

Thanks all for your help!

... Also and I believe irrelevant but who knows, I set up git global config with the github information but on the project for the company I have git config --local... that should be no problem right?

==== UPDATE ====

So I've noticed that in the debug section the following:

debug1: Offering RSA public key: /Users/maumercado/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/maumercado/.ssh/id_dsa

Why is it giving id_rsa as my public key when its actually the private key and id_dsa as my private key when that does not even exist?

Upvotes: 0

Views: 955

Answers (2)

maumercado
maumercado

Reputation: 1473

After a looong debugging time, thinking and analyzing, I redid everything following this http://dev.remarkablewit.com/redmine/projects/dev-server/wiki, it works, at least for me, also in the gitosis.conf I added under [gitosis] loglevel=DEBUG to help me out a little bit more.

Upvotes: 0

iltempo
iltempo

Reputation: 16012

There is no restriction on how often you use a public ssh key and where. The name in the key is more for documental purposes. As long as the system supports the type of key (RSA/DSA).

Did gitosis ever work with your key? It's a bit tricky in configuration. Also ensure that there are no line breaks in it's key file there.

Regarding your git config question: Local settings override global ones. But thats just fine the way you do it.

Upvotes: 1

Related Questions