git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git + ssh + key authentication feature-request

From
Junio C Hamano <junkio@cox.net>
Date
Feb 8, 2006, 22:56 UTC
Message-ID
<7v4q39o3xs.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<43EA7D57.7040409@iaglans.de>
Nicolas Vilz 'niv' <niv@iaglans.de> writes:
Show 5 quoted lines
> in my case it would be only one system-user which has full access to
> several repositories. At this time, the users which use that account,
> have to give a password, which isn't that bad... it would be easier
> and more secure for me, not to give a password, but ask the users for
> the ssh pubkey..
I do not know where you are getting the password idea.

The conclusion of that thread is that it is not worth trying to co-mingle more than one physical developer into one home directory, and does not have much to do with use of password or public key authentication.

That thread describes:
 - you can use ssh public key authentication for developers;
 - you do not have to give them full shell access by using
   git-shell;
   
 - HOWEVER you cannot tell each developers apart if you add one
   key per developer to the same $HOME/.ssh/authorized_keys file.

The last point is not about git at all, but comes from how ssh daemon operates. It roughly goes like this:

 - The client says "I am me at the remote host, use this public
   key to prove that to the other end".  Often you do not have
   to give -l and -i but when you fully spell out the command
   line, it would be something like:
	$ ssh -l me -i identity-file remote.host.example.com
   Your client sends "me" and the public key to the remote end.
 - The ssh daemon running on the remote site says, "Hmph, let's
   see if you are really "me" as you claim."  It does the
   following things:
    1. Look "me" up from its user database (be it /etc/passwd,
       NIS or LDAP) to find out the user's home directory.
       Let's say the "struct passwd.pw_dir" says it is
       "/home/me".
    2. Check to see if /home/me/.ssh/authorized_keys exists, all
       the elements in the path to the file is secure (e.g. if
       /home/me/.ssh can be modified by somebody other than
       "me", what is in authorized_keys is not trustworthy).
       That means /home/me/.ssh/authorized_keys must be owned by
       "me" and at least mode 0644 or stricter.
    3. Reads the keys in that file, and finds what is sent as
       the public key from the client.
    4. Uses that public key to challenge the client to make sure
       the client has the corresponding private key.

What this implies is that sharing the home directory among multiple UNIX users would not work with ssh daemon the way you expect. The check in step 2 would fail for all but one user.

Being able to list more than one key in authorized_keys is so that you can use more than one key to become the _same_ user, and does not give you the ability to become a user other than the one that owns that home directory on that remote host.

So while you could make a repository "/pub/project.git" the home directory of _one_ UNIX user, and store her key in the file "/pub/project.git/.ssh/authorized_keys", that would not work very well for a shared repository setup if you want to be able to tell more than one physical users apart.

You _could_ tell them to use the same -l option and log-in as the same UNIX user with their own keys, though. But that way you cannot tell which developer pushed into the repository (of course if you trust the commits, commit log message would say the committer ident).

Previous: Nicolas Vilz 'niv'Next: Mark Wooding
Message 6 of 15 in “git + ssh + key authentication feature-request”
  1. Nicolas Vilz 'niv'Feb 8, 2006
  2. Junio C HamanoFeb 8, 2006
  3. Nicolas Vilz 'niv'Feb 8, 2006
  4. Linus TorvaldsFeb 8, 2006
  5. Nicolas Vilz 'niv'Feb 9, 2006
  6. Junio C HamanoFeb 8, 2006
  7. Mark WoodingFeb 9, 2006
  8. Junio C HamanoFeb 9, 2006
  9. Mark WoodingFeb 9, 2006
  10. Nicolas Vilz 'niv'Feb 9, 2006
  11. Linus TorvaldsFeb 8, 2006
  12. Nicolas Vilz 'niv'Feb 9, 2006
  13. Junio C HamanoFeb 8, 2006
  14. Nicolas Vilz 'niv'Feb 9, 2006
  15. Alan ChandlerFeb 8, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.