太长不看;

太长不看;

我运行ssh-keygen命令时出现Too many arguments错误。我该如何解决?

C:\Users\sanke\Downloads>dir
 Volume in drive C is Windows
 Volume Serial Number is 8273-E957

 Directory of C:\Users\sanke\Downloads

17/07/2019  17:26    <DIR>          .
17/07/2019  17:26    <DIR>          ..
17/07/2019  17:26             1,692 mynewKP.pem
               1 File(s)          1,692 bytes
               2 Dir(s)  12,695,531,520 bytes free

C:\Users\sanke\Downloads>ssh-keygen -y -f mynewKp.pem mynewKP.pub
Too many arguments.
usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa]
                  [-N new_passphrase] [-C comment] [-f output_keyfile]
       ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
       ssh-keygen -i [-m key_format] [-f input_keyfile]
       ssh-keygen -e [-m key_format] [-f input_keyfile]
       ssh-keygen -y [-f input_keyfile]
       ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
       ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
       ssh-keygen -B [-f input_keyfile]
       ssh-keygen -F hostname [-f known_hosts_file] [-l]
       ssh-keygen -H [-f known_hosts_file]
       ssh-keygen -R hostname [-f known_hosts_file]
       ssh-keygen -r hostname [-f input_keyfile] [-g]
       ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
       ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
                  [-j start_line] [-K checkpt] [-W generator]
       ssh-keygen -s ca_key -I certificate_identity [-h] [-U]
                  [-D pkcs11_provider] [-n principals] [-O option]
                  [-V validity_interval] [-z serial_number] file ...
       ssh-keygen -L [-f input_keyfile]
       ssh-keygen -A
       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
                  file ...
       ssh-keygen -Q -f krl_file file ...

答案1

太长不看;

使用ssh-keygen -y -f mynewKp.pem


使用文本说明

ssh-keygen -y [-f input_keyfile]

此处选项含义如下(取自手动的):

  • -y:读取私有的 OpenSSH 格式文件并将 OpenSSH 公钥打印到标准输出
  • -f:密钥文件的文件名。

该选项之后-f还声明input_keyfile它期望输入密钥文件的文件名。

您的命令具有以下形式:

ssh-keygen -y -f input_filename.pem output_filename.pub

但该命令只接受一个文件名参数,而你提供了两个。因此出现错误Too many arguments

因此您应该使用:

ssh-keygen -y -f mynewKp.pem

相关内容