14

I am searching for a way to extract the public key from the authentication agent. I want to be able to write the public key out into a file, after i added the key to the ssh-agent (ssh-add ~/.ssh/id_rsa).

ssh-add -l displays the fingerprint for me, but is there a way to get the complete public key?

Thank you for your suggestions

1
  • I'm voting to move this question to Unix & Linux since it's more about how unix works than about systems administration. In other words, the close vote currently on your question is not about actually closing but about moving. Commented Aug 8, 2016 at 9:38

1 Answer 1

21

man ssh-add will show you all the options available. One of them is ssh-add -L. As the man page says,

 -L Lists public key parameters of all identities currently repre- sented by the agent. 

In other words, it will print out the public key.

2
  • 3
    Thank you, this man page line was misleading, due to the word "parameters". Commented Aug 8, 2016 at 9:41
  • Definitely misleading, I totally parsed that line and thought about it for a long second, but it did not seem like the right option. Turns out it was ;O Commented Jul 9, 2023 at 0:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.