Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何验证两个字符串是否是使用ssh keygen生成的密钥对?_Linux_Ssh_Ssh Keys - Fatal编程技术网

Linux 如何验证两个字符串是否是使用ssh keygen生成的密钥对?

Linux 如何验证两个字符串是否是使用ssh keygen生成的密钥对?,linux,ssh,ssh-keys,Linux,Ssh,Ssh Keys,我有一个用ssh-keygen生成的私钥和一个公钥列表。我想知道其中一个公钥是否是私钥的公钥对。是否可以使用CLI比较私钥/公钥对以查看它们是否匹配?您可以使用 ssh-keygen -y -y This option will read a private OpenSSH format file and print an OpenSSH public key to stdout. 例如: $ ssh-keygen -y -f my_file AAAAB3N...

我有一个用ssh-keygen生成的私钥和一个公钥列表。我想知道其中一个公钥是否是私钥的公钥对。是否可以使用CLI比较私钥/公钥对以查看它们是否匹配?

您可以使用

ssh-keygen -y

-y      This option will read a private OpenSSH format file and print an
        OpenSSH public key to stdout.
例如:

$ ssh-keygen -y -f my_file
AAAAB3N...
如果需要,您可以在公钥列表中搜索提取的部分密钥,以找到正确的密钥