Linux生成RSA SSH密钥
时间:2020-01-09 10:41:35 来源:igfitidea点击:
如何在Linux操作系统下生成ssh RSA密钥?
您需要按如下方式使用ssh-keygen命令生成RSA密钥(打开终端并执行以下命令):
ssh-keygen -t rsa
或者
ssh-keygen
输出示例:
Enter file in which to save the key (/home/Hyman/.ssh/id_rsa): Created directory '/home/Hyman/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/Hyman/.ssh/id_rsa. Your public key has been saved in /home/Hyman/.ssh/id_rsa.pub. The key fingerprint is: 58:3a:80:a5:df:17:b0:af:4f:90:07:c5:3c:01:50:c2 Hyman@debian
-t type选项指定要创建的密钥的类型。
协议版本2的可能值rsa或dsa。
$HOME/.ssh存储以下两个文件:
$HOME/.ssh/id_rsa
您的RSA私钥$HOME/.ssh/id_rsa.pub
您的公共RSA密钥
请不要与任何人共享密钥文件。
您可以按照以下步骤将密钥上载到远程服务器:
ssh-copy-id [email protected]
最后,您可以按照以下步骤登录到远程服务器:
ssh [email protected] scp file.txt [email protected]:~/data2/