【问题标题】:Duplicating an ssh private key file复制 ssh 私钥文件
【发布时间】:2020-04-07 02:45:21
【问题描述】:

我在~/.ssh/id_rsa 下有一个私钥。运行ssh-keygen -l -f ~/.ssh/id_rsa 确认密钥有效。

我正在尝试创建另一个包含此密钥的文件。例如,

cp ~/.ssh/id_rsa ~/.ssh/id_rsa.dupe
chmod 0400 ~/.ssh/id_rsa (to make permissions the same for both files)

但是当我运行ssh-keygen -l -f ~/.ssh/id_rsa.dupe 时,我得到~/.ssh/id_rsa.dupe is not a key file.

【问题讨论】:

  • 对于与编写代码无关的问题,Unix & LinuxSuper User 是更好的选择。
  • 也就是说——当您读取或 md5sum 文件时,这是否确认它们是相同的?
  • 注意——谢谢@CharlesDuffy。是的,运行 md5sum 会为每个文件返回相同的哈希值。

标签: ssh openssh


【解决方案1】:

这是预期的行为。 ssh-keygen -l 指的是 公钥文件,根据其文档:

  -l     Show fingerprint of specified public key file.

如果你想生成私钥并生成公钥,你可以使用-y来做到这一点:

ssh-keygen -y -f ~/.ssh/id_rsa.dupe >~/.ssh/id_rsa.dupe.pub
ssh-keygen -l -f ~/.ssh/id_rsa.dupe.pub

【讨论】:

    猜你喜欢
    • 2012-08-16
    • 2012-09-14
    • 2021-05-15
    • 2020-11-27
    • 1970-01-01
    • 1970-01-01
    • 2020-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多