最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】使用ssh-keygen去把pem转换为pub

Linux crifan 8162浏览 0评论

折腾:

【记录】SecureCRT使用pem文件通过SSH登录远程服务器

期间,需要去学习使用ssh-keygen

ssh-keygen 用法

ssh-keygen 基本用法 | Yet Another Summer Rain

ssh-keygen的使用方法 – The Last Song 的专栏 – 博客频道 – CSDN.NET

如何使用ssh-keygen生成key – 冀博 – 博客频道 – CSDN.NET

➜  test ssh-keygen –help
ssh-keygen: illegal option — –
usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
                  [-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 -D pkcs11
       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] [-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 …

【总结】

➜  test ssh-keygen -p -f runningfast_aws_test.pem
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.
➜  test ll
total 88
-rw-r–r–  1 crifan  staff   847B  2  7 20:37 local_config_testServer.py
drwxr-xr-x  4 crifan  staff   136B  2 10 15:29 logs
-rw——-@ 1 crifan  staff   1.6K  2 10 15:41 runningfast_aws_test.pem
-rw-r–r–  1 root    staff    35K  2  7 20:57 runningfast_from_production.sql
➜  test ssh-keygen -e -f runningfast_aws_test.pem > runningfast_aws_test.pem.pub
➜  test ll
total 96
-rw-r–r–  1 crifan  staff   847B  2  7 20:37 local_config_testServer.py
drwxr-xr-x  4 crifan  staff   136B  2 10 15:29 logs
-rw——-@ 1 crifan  staff   1.6K  2 10 15:41 runningfast_aws_test.pem
-rw-r–r–  1 crifan  staff   512B  2 10 15:42 runningfast_aws_test.pem.pub
-rw-r–r–  1 root    staff    35K  2  7 20:57 runningfast_from_production.sql

其中的:

  • ssh-keygen -p -f runningfast_aws_test.pem
    • 对于提示empty for no passphrase时,先后两次回车即可
    • -p指的是:要求改变某私钥文件的密语而不重建私钥。程序将提示输入私钥文件名、原来的密语、以及两次输入新密语。
  • ssh-keygen -e -f runningfast_aws_test.pem > runningfast_aws_test.pem.pub
    • -e 读取OpenSSH的私钥或公钥文件,并以 RFC 4716 SSH 公钥文件格式在 stdout 上显示出来。该选项能够为多种商业版本的 SSH 输出密钥。

转载请注明:在路上 » 【已解决】使用ssh-keygen去把pem转换为pub

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.181 seconds, using 22.06MB memory