如何使用Ssh Keygen生成RSA密钥?

Ssh provides secure access to the remote system. The traffic between systems are encrypted using encryption algorithms. There are different encryption algorithms. RSA is the most popular asymmetric encryption algorithm. In this tutorial we will look how to create RSA keys with ssh-keygen

Ssh提供对远程系统的安全访问。 系统之间的流量使用加密算法进行加密。 有不同的加密算法。 RSA是最流行的非对称加密算法。 在本教程中,我们将研究如何使用ssh-keygen创建RSA密钥

RSA历史(RSA History)

RSA algorithm is created by researchers named Ron Rivest, Adi Shamir and Leonard Adleman in the MIT. And named with their names first letters. It is asymmetric or public encryption algorithm provides a lot of flexibility. We can generate different size of keys with RSA. RSA is used to make secure SSH, OpenGP, S/MIME, SSL/TLS etc.

RSA算法是由麻省理工学院的研究人员Ron Rivest,Adi Shamir和Leonard Adleman创建的。 并以他们的名字首字母命名。 它为非对称或公共加密算法提供了很大的灵活性。 我们可以使用RSA生成不同大小的密钥。 RSA用于制作安全的SSH,OpenGP,S / MIME,SSL / TLS等。

使用Ssh-keygen生成RSA密钥 (Generate RSA Key with Ssh-keygen)

Actually ssh-keygen will create RSA keys by default. So we do not have to specify the algorithm but in order to be sure and provide information we can explicitly specify the RSA key creation. We will use -t option in order to specify the RSA algorithm.

实际上, ssh-keygen默认会创建RSA密钥。 因此,我们不必指定算法,但是为了确定并提供信息,我们可以显式指定RSA密钥创建。 我们将使用-t选项以指定RSA算法。

$ ssh-keygen -t RSA
Generate RSA Key with Ssh-keygen
Generate RSA Key with Ssh-keygen
使用Ssh-keygen生成RSA密钥

生成不同路径的RSA密钥(Generate RSA Key To Different Path)

By default RSA key is generated into user home directory ~/.ssh/id_rsa . We can change this default directory during the generation or by providing the path as parameter. We will use -f option in order to change path and file name. We will create key named test in to the current working directory.

默认情况下,RSA密钥会生成到用户主目录~/.ssh/id_rsa 。 我们可以在生成过程中或通过提供路径作为参数来更改此默认目录。 我们将使用-f选项来更改路径和文件名。 我们将在当前工作目录中创建名为test密钥。

$ ssh-keygen -t RSA -f test
Generate RSA Key To Different Path
Generate RSA Key To Different Path
生成不同路径的RSA密钥

There will be two files named;

将有两个文件名为:

  • test is the private key

    test是私钥

  • test.pub is the public key

    test.pub是公钥

LEARN MORE  How To Create and Setup SSH Keys For Passwordless and Public Key Based Authentication In Linux?
了解更多信息如何在Linux中为无密码和基于公钥的身份验证创建和设置SSH密钥?

翻译自: https://www.poftut.com/generate-rsa-keys-ssh-keygen/

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值