复制ssh私钥文件

时间:2020-04-06 17:55:34

标签: ssh openssh

我在~/.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.

1 个答案:

答案 0 :(得分: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
相关问题