Bug 3090

Summary: ssh-keygen -e prints request for input message to stdout
Product: Portable OpenSSH Reporter: dinar <qdinar>
Component: ssh-keygenAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED WORKSFORME    
Severity: minor CC: djm
Priority: P5    
Version: 7.9p1   
Hardware: All   
OS: Linux   

Description dinar 2019-11-08 02:07:31 AEDT
i have this instruction in my hosting help page:
ssh-keygen -e > ~/.ssh/key_rsa_alt.pub
when i run this, it prints an empty line and stops, on second Enter it completes its execution. when i cat the .ssh/key_rsa_alt.pub, it has
Enter file in which the key is (/home/dinar/.ssh/id_rsa): ---- BEGIN SSH2 PUBLIC KEY ----
in beginning.

man ssh-keygen says: -e This option will read a private or public OpenSSH key file and print to stdout the key in one of the formats specified by ...

so, i think, ssh-keygen should not print "Enter file in which the key is" to stdout and should print it into terminal. is it possible? by searching "how to print to terminal but not print to stdout" in google, i have found this: https://stackoverflow.com/q/23118252 .
Comment 1 Damien Miller 2020-01-25 17:17:42 AEDT
You can avoid the prompt by passing the key that you want to export on the commandline using the "-f pathname" flag, e.g.

ssh-keygen -ef ~/.ssh/key_rsa_alt > key_rsa_alt.pub
Comment 2 Damien Miller 2020-02-14 15:59:18 AEDT
Closing all resolved bug with release of openssh-8.2