Search code examples
linuxgithubsshpki

How to get the user info by the public key the user sent over ssh?


When a user connect over SSH with public key, how did Github detect which user it is?

ssh -T git@github.com
Hi **Ben**! You've successfully authenticated, but GitHub does not provide shell access.

How to implement such a feature, especially consider that the user info is in some database like MySQL?


Solution

  • I'm fairly certain this is done using a centralized authorized_keys file along with the command option. Check out the AUTHORIZED_KEYS FILE FORMAT section of the man page.