在 2022 年生成 SSH 公钥 | Generate SSH public keys in 2022

标签: none

2022 年生成公钥参数 Ed25519

在此之前推荐用的加密方式是 RSA 4096 RSA 逐渐在被淘汰, 取而代之的是 Ed25519. 现在 Github 和大多数人建议尽可能使用 Ed25519

ssh-keygen -t ed25519 -C "your_email@example.com"

默认轮数为 16。您可以使用 -a 参数增加轮数。但是,请记住,轮数越多,验证速度就越慢,因此登录速度会慢一些。默认值 16 可能会少于 1 秒登录,而值 150 或更大可能会增加几秒或更多的延迟

ssh-keygen -t ed25519 -a 100 -C "your_email@example.com"

旧的生成参数不建议使用

RSA 4096

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

如果什么不都指定, 默认创建 RSA 2048

ssh-keygen -C "your_email@example.com"

ssh-copy-id 将公钥复制到远程机器中

一般情况下不需要 -i 参数

$ ssh-copy-id -i .ssh/id_ed25519.pub user@192.168.0.1

Why use -t rsa -b 4096 with ssh-keygen?


扫描二维码,在手机上阅读!

添加新评论