Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm basically trying to do this using openssh:

I have a private key, however it isn't in file (it's in memory). Now, I want to create the public key in openssh format. For that I would generally run ssh-keygen -y -f <filename>. However I do not have a file name, since i don't have a file. I'd like to feed openssh from the standard input somehow instead. How would I do that?

If it isn't possible I wouldn't mind having openssh generate both private and public keys BUT I can't write them to a file. Instead I would like to write them both to stdout. How can I achieve this?

share|improve this question
Could you explain your aversion to files? What exactly are you trying to do here? Why can't you use files? – terdon Jun 23 '13 at 13:05
I am doing this as an automated task from a java server. I could write a file to the filesystem, run ssh-keygen on it and then delete it. However, this is an unnecessary overhead. I would like to just give the private key from stdin and redirect the output to stdout. the ssh-keygen utility does not seem to allow me to do this although to me this seems very basic – ShinySpiderdude Jun 23 '13 at 14:35
Perhaps this StackOverflow question might help? – Calrion Oct 17 '13 at 1:37

You must log in to answer this question.

Browse other questions tagged .