ssh_keygen 手册 https://man7.org/linux/man-pages/man1/ssh-keygen.1.html
ssh-keygen是一个用于创建SSH认证密钥对的工具。这些密钥对用于自动登录、单点登录和主机身份验证。在Linux上,密钥对默认存储在用户家目录的“.ssh”目录。
例如使用id_rsa密钥登录SSH: ssh -i id_rsa testuser@192.168.1.10
要生成新的密钥对,可以在命令行中直接运行ssh-keygen命令。默认情况下,它将提示输入密钥文件的名称和位置,以及选择加密算法和密钥大小。也可以使用参数直接指定。
-b 参数指定密钥位数
-m ,这个参数作用是指定密钥生成的密钥的格式
-t ,这个参数作用是指定要创建的密钥的类型
密钥文件名称
~/.ssh/id_dsa
~/.ssh/id_ecdsa
~/.ssh/id_ecdsa_sk
~/.ssh/id_ed25519
~/.ssh/id_ed25519_sk
~/.ssh/id_rsa
Contains the DSA, ECDSA, authenticator-hosted ECDSA,
Ed25519, authenticator-hosted Ed25519 or RSA authentication
identity of the user. This file should not be readable by
anyone but the user. It is possible to specify a
passphrase when generating the key; that passphrase will be
used to encrypt the private part of this file using 128-bit
AES. This file is not automatically accessed by ssh-keygen
but it is offered as the default file for the private key.
ssh(1) will read this file when a login attempt is made.
~/.ssh/id_dsa.pub
~/.ssh/id_ecdsa.pub
~/.ssh/id_ecdsa_sk.pub
~/.ssh/id_ed25519.pub
~/.ssh/id_ed25519_sk.pub
~/.ssh/id_rsa.pub
Contains the DSA, ECDSA, authenticator-hosted ECDSA,
Ed25519, authenticator-hosted Ed25519 or RSA public key for
authentication. The contents of this file should be added
to ~/.ssh/authorized_keys on all machines where the user
wishes to log in using public key authentication. There is
no need to keep the contents of this file secret.
/etc/moduli
Contains Diffie-Hellman groups used for DH-GEX. The file
format is described in moduli(5).