Pregunta

Is there a way for a program at the server to get the public key that the user used for ssh login?

For example, github knows that it's user "Ben" by searching the public key from their database.

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

My question is how to get the public key then?

¿Fue útil?

Solución

Only the SSH server (sshd) can retrieve that information. It is not exposed to processes launched from the server, such as the shell.

The fact that Github is doing this, as well as some circumstantial evidence on their blog, strongly suggests that Github is running a custom SSH server (i.e, not OpenSSH). You would need to write your own SSH server to replicate this functionality.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top