gitosis: same user multiple machines
Asked Answered
D

4

12

In git/gitosis a single ssh key is stored with the filename the same as user name.

i.e. myusername.pub

If I want to access a repository from many machines, must I make a new user from each location or is there a way to have multiple ssh keys for a single user.

Dolan answered 23/6, 2010 at 19:0 Comment(0)
E
11

Actually, gitosis supports that. You just have to add the ssh key on a new line in the key file.

Eucken answered 24/6, 2010 at 20:38 Comment(0)
C
2

You can no longer add a key per line in the .pub files as suggested by igorw. I tried it and got the following message back.

WARNING: a pubkey file can only have one line (key); ignoring kent.pub
         Perhaps you're using a key in a different format (like putty/plink)?
         If so, please convert it to openssh format using 'ssh-keygen -i'.
         If you want to add multiple public keys for a single user, use
         "[email protected]" file names.  See the "one user, many keys"
         section in doc/3-faq-tips-etc.mkd for details.

I tried the suggested solution which was to create a new pub file with the name <user>@<host>.pub and it worked fine.

Crotchety answered 1/12, 2011 at 9:31 Comment(4)
It dose not work for me. I installed gitosis 0.2-6.20080825git.el5 from YUM.Thant
Are you sure you're using gitosis and not gitolite?Pasteurizer
doh! Yes I am using gitolite. Sorry for the mistake. The above does not apply to gitosis.Crotchety
Could you please remove that answer then ?Hutner
I
0

Users in gitosis are not "normal" users, so yes, you create a user per ssh key. This article explains it very well.

(Alternatively you copy your key on all your machines, not as nice/secure but works fine too)

Improvise answered 23/6, 2010 at 19:16 Comment(0)
G
0

Gitosis talks through SSH, and uses SSH keys to uniquely identify users. If you want to act as the same user on multiple machines, you simply need to copy the private key (~/.ssh/id_rsa) to the ~/.ssh directory on the second machine. If the second machine already has a key, you can copy the key to a different filename (say ~/.ssh/mygitkey) and configure SSH to use it for the appropriate server. Edit/create the ~/.ssh/config file and add this content:

host mygitserver
    identityfile ~/.ssh/mygitkey
Gorey answered 1/7, 2010 at 20:24 Comment(1)
This will work but from a security perspective it’s not a great idea to share private keys between machines.Udela

© 2022 - 2024 — McMap. All rights reserved.