ssh-keygen accepting stdin
Posted
by Ryan
on Stack Overflow
See other posts from Stack Overflow
or by Ryan
Published on 2010-04-14T06:42:43Z
Indexed on
2010/04/14
6:43 UTC
Read the original article
Hit count: 319
I am trying to call ssh-keygen
using a variable through bash
as an input instead of a file to get a fingerprint of a public key.
This method does not work as it says the key file is invalid (it's correct for sure)
echo $pubkey | ssh-keygen -lf /dev/stdin
This does work
ssh-keygen -lf /dev/stdin < alpha.pub
This does not work because I get an ambiguous redirect
ssh-keygen -lf /dev/stdin < $(echo $pubkey)
I would appreciate some insight as to how to get ssh-keygen to read from a variable with a public key and if possible, an explanation as to why the redirects aren't doing what I think they should be doing. I searched online but many of the redirect tutorials didn't seem to answer my questions.
© Stack Overflow or respective owner