Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the ssh-keygen command in Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use the ssh-keygen command in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The Linux common command ssh-keygen command is used to generate, manage, and transform authentication keys for "ssh". It supports both RSA and DSA authentication keys.

Command format syntax ssh-keygen [- Q] [- b bits]-t type [- N new_passphrase] [- C comment] [- f output_keyfile] ssh-keygen-p [- P old_passphrase] [- N new_passphrase] [- f keyfile] ssh-keygen-I [- f input_keyfile] ssh-keygen-e [- f input_keyfile] ssh-keygen-y [- f input_keyfile] ssh- Keygen-c [- P passphrase] [- C comment] [- f keyfile] ssh-keygen-l [- f input_keyfile] ssh-keygen-B [- f input_keyfile] ssh-keygen-D reader ssh-keygen-F hostname [- f known_hosts_file] ssh-keygen-H [- f known_hosts_file] ssh-keygen-R hostname [- f known_hosts_file] ssh-keygen-U reader [- f input_keyfile] Ssh-keygen-r hostname [- f input_keyfile] [- g] ssh-keygen-G output_file [- v] [- b bits] [- M memory] [- S start_point] ssh-keygen-T output_file-f input_file [- v] [- a num_trials] [- W generator] Common options-b: specify key length -e: read the openssh private key or public key file;-C: add comments;-f: specify the file name to save the key;-I: read the unencrypted ssh-v2-compatible private / public key file and then display the openssh-compatible private / public key on the standard output device;-l: display the fingerprint data of the public key file;-N: provide a new password;-P: provide (old) password;-Q: silent mode -t: specifies the type of key to create. Refer to the example to create a default key

[root@localhost ~] # ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/ root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again:Your identification has been saved in / root/.ssh/id_rsa.Your public key has been saved in / root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:QfclO+AvXZ/O6vGNfzo4P2pftiHRoKG2fgc5p9bvu1o root@localhost.localdomainThe key's randomart image is:+--- [RSA 2048]-+ |. O. . | |. O o + | |. .. +. | | ooooooooooo.. | | So..+. | O. | |. . =. + | |. * + Eo | |. + + oO+= | | .o. + OO%* | +-[SHA256]-+ [root@localhost ~] # specify the type of key to be created

[root@localhost] # ssh-keygen-t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/ root/.ssh/id_rsa): / root/.ssh/id_rsa already exists.Overwrite (YPIO)? YEnter passphrase (empty for no passphrase): Enter same passphrase again:Your identification has been saved in / root/.ssh/id_rsa.Your public key has been saved in / root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:nTaoqOxlG6IQQ2zDTMvSk2EON+4tLrYqPy7IBrstoy4 root@localhost.localdomainThe key's randomart image is:+--- [RSA 2048]-+ |.. = | | * B.+ | | .x * | +.. oo. | | o o. S = |. +. . . . . | | * oo =. | | | EBo= o | |% @ B.. | | +-[SHA256]-+ [root@localhost ~] # use the-t parameter to create a specified key type and add comments |

[root@localhost] # ssh-keygen-t rsa-C "deng@qq.com" Generating public/private rsa key pair.Enter file in which to save the key (/ root/.ssh/id_rsa): / root/.ssh/id_rsa already exists.Overwrite (ymen)? YEnter passphrase (empty for no passphrase): Enter same passphrase again:Your identification has been saved in / root/.ssh/id_rsa.Your public key has been saved in / root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:Wx3MWwj36fwhcnb6hjdIIJ3SUggCLcmFq62Earqy2E0 deng@qq.comThe key's randomart image is:+--- [RSA 2048]-+ |.. * o. O. | | =. . * o. | | o + * + | |. + * * | |. O S =. + + oo | | .o. O +. +.. | | o. E. . o. | | + o. O. + | | Oo. . O.. | +-[SHA256]-+ [root@localhost ~] # read the private key or public key file of openssh

[root@localhost ~] # ssh-keygen-eEnter file in which the key is (/ root/.ssh/id_rsa):-BEGIN SSH2 PUBLIC KEY-Comment: "2048-bit RSA, converted by root@localhost.localdomain from O" AAAAB3NzaC1yc2EAAAADAQABAAABAQCyQ/iZYPZHH7+4Gcfq259xChnidsf25piKsnRi+o/XZcD0s9QL8oX24OuX5pPQcmfD6Rw6sQCrTy66LrSw2NmPpKc0XdUbXEkLYBN4d3SY+ZLT3Ot8L6jaDmwgXsBu8lTXzAEWLm+16RXAZAB/27ohi48PfcIDYyeJ1JDpieCJ1/a/KrR9V4erWVBt/ZE8KoC0MTQlUn7H3oABVS9O6sdY4dYc/T9l33EbqZMc2feYZnuWtrPdrYfz37C+kzg3ZrDojGXtiWk1p/PG5KoAH6GzuYYIuMtrUTnadRv4wZo29RF+n5Ty8HEeYqSceHWWvwJjqnpqj9cgeNQvq6E3PJbD---- END SSH2 PUBLIC KEY-[root@localhost ~] # quiet mode generation key pair

[root@localhost] # ssh-keygen-Q-t rsaEnter file in which to save the key (/ root/.ssh/id_rsa): / root/.ssh/id_rsa already exists.Overwrite (YPAPO)? YEnter passphrase (empty for no passphrase): Enter same passphrase again: [root@localhost ~] # these are all the contents of this article entitled "how to use ssh-keygen commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report