Bug 3090 - ssh-keygen -e prints request for input message to stdout
Summary: ssh-keygen -e prints request for input message to stdout
Status: CLOSED WORKSFORME
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-keygen (show other bugs)
Version: 7.9p1
Hardware: All Linux
: P5 minor
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-08 02:07 AEDT by dinar
Modified: 2020-02-14 15:59 AEDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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