I forgot the passphrase for my ssh private key, but it's still stored in gnome-keyring, so it seems to me that I should be able to recover it. Seahorse lets me recover web site passwords from my keyring, but I don't see a way to recover my ssh passphrase. Can someone tell me how to do this?
3 Answers
After some searching and a bit of arguing, two small python programs turned up that do exactly what I needed. Both were able to dump all the passwords that are stored by gnome-keyring, including my ssh key's passphrase. (This is secure, of course, because it only works once I have unlocked my keyring.) See these blog posts for the code:
https://ins3cure.blogspot.fr/2012/07/extracting-gnome-keyring-credentials.html
Thank you, Michael Schurter and Liviu. I can now simply update my passphrase instead of going through the trouble of replacing my old ssh key on every system where it is installed.
- 115
- 406
- 1
- 3
- 12
You can use Python and secretstorage
import secretstorage
conn = secretstorage.dbus_init()
collection = secretstorage.get_default_collection(conn)
print(collection.is_locked())
collection.unlock()
for item in collection.get_all_items():
print(item.get_label())
print(item.get_attributes())
print(item.get_secret())
print("-" * 80)
- 3,604
- 10
- 36
- 65
If gnome-keyring works just like ssh-agent, you don't. The passphrase cannot be recovered once it is forgotten. It is used to encrypt the private key and if you forget it... well that's it.
If it is indeed stored internally, then that's another issue.
- 2,077