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 generate ssh key and obtain key in Linux system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to generate the ssh key and obtain the key in the Linux system. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

SSH is a reliable protocol designed to provide security for remote login sessions and other network services.

1. First of all, what is the abbreviation of SSH SSH for Secure Shell, developed by IETF's network team (Network Working Group); SSH is a security protocol based on the application layer. SSH is a reliable protocol designed to provide security for remote login sessions and other network services. The use of SSH protocol can effectively prevent information leakage in the process of remote management. SSH was originally a program on the UNIX system, and then rapidly expanded to other operating platforms. When used correctly, SSH can make up for loopholes in the network. The SSH client is suitable for a variety of platforms. Advantages of 2.SSH 1 "traditional FTP and Telnet transmit data, user accounts and passwords in clear text in the network, so they are vulnerable to man-in-the-middle attacks." By using SSH, you can encrypt all transmitted data, making man-in-the-middle attacks impossible and preventing DNS and IP spoofing. 2 "the second benefit is that the transmitted data is compressed, so the transmission speed can be accelerated. 3. How do you realize the benefits of SSH? [how to encrypt] SSH uses SSH Key to perform the key-based security verification mentioned earlier. What is 4.SSH-Key? The copy code 1 "SSH-Key is a key pair." [one is a public key and the other is a private key] 2 "the public key is for others to use. The private key is for your own use. 3 "who are the others? It could be a GitLab server. Who are you? It could be local. 4 "example 4.1" locally want to use git to pull code from gitHub/gitlab. Configure the GitHub/GitLab with a public key, and the public key can be used as an encrypted box to put the code in the box. 4.3 "after being pulled locally, use the private key to open the encrypted box." You can get the code. 4.4 "throughout the process, there is no username / password transmitted in the network, so it will not be intercepted by others to crack your data 5." therefore, the intuitive function of SSH-Key is to [make it easy for you to log in to the SSH server without entering a password] the key type of the copy code 5.SSH-Key has RSA and DSA authentication keys 6. Step 1 of the command to generate SSH-Key on linux "first, you have to cd / root 2 under the root directory" to see if SSH-Key already exists [is to see if the hidden directory .ssh exists] ls-al ~ / .ssh

If not, create a new one. If so, it is recommended to delete and then create a new one.

Delete command [actually delete .ssh this hidden directory] rm-rf .ssh 3 "newly generated SSH-key [replace with your own mailbox] ssh-keygen-t rsa-C" sxd4business@qq.com "after typing the command, you will be asked to enter your password to protect your key, etc., a total of three times need to enter, you directly enter three times! [the key is that if you forget to set yourself, you will have to regenerate it] [- C is to set a comment for your key. If you don't want to set it to your mailbox, you can set it to something else]

4 "after it is generated, a .ssh hidden directory will be generated under the / root directory, that is, the current user's directory, in which there will be [id_rsa] and [id_rsa.pub] files, one is the private key and the other is the public key. You can copy and use it now.

-BEGIN RSA PRIVATE KEY- MIIEpQIBAAKCAQEA36h8i3yc5glv7kURRNkkdrYYOkeDcUHF4PSi64ZL2DMGmu2/ mzHF3CDfISAZUFp3cTd0yqRIF7LAfmlQrbDmFDk+jwMELoeVurUa8yaCVyz0pqfR 44ZYeEBToz53GEJ9k8n2nfOPBSqxhjblRxJgCKv7PIPqEI53h7laBKagyZ6bN2qm yMcEjQmQzId4Ub7pweEhLH6FyKCx/upF7DxfJe2EyzAZJfLzfkb7lz1roLlDRngc Gmb+aPmam3lIQHDrFLzbwCCox638Xg1/6gpw4yIFYsZqSOUgfjbKO1j03JLEMtzA PPrH+eFq83IO0wkgVd+1FxIGLj5KVG/ygftqcQIDAQABAoIBAAPqE/vw+2H/Skk2 Rj4ZOs0lFLl4ZPGHgCoWvf83Q36OLhBqFs9liJv4q08OG8NPQgXmPZIKXASmKT5N I49WqEA0XEbue5VA5Dr3Tnhw9RkHfWSpTUAZKtU38v7JahYvm7kJcNqE17z0aVT7 AvpCdRHRyLzfZipSA/+JG+026Vt99b70wD4B8SO0wpXj0Jr3VmP0tAAbdtecZ3mv EQIVr4W+7D6O+o625ZiG+rU1nhuqQCN17YCvbOc48LkxLJADzqccUiUmm7nNSo6a YAWPClFEexLGdNkU6Xb90/ujxdGDYWwvVC0bS8tTstPbIYQZm4J2Ksfcei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6W6tRrzJoJXLPSmp9Hjhlh5QFOjPncYQn2Tyfad848FKrGGNuVHEmAIq/s8g+oQjneHuVoEpqDJnps3aqbIxwSNCZDMh4hRvunB4SEsfoXIoLH+6kXsPF8l7YTLMBkl8vN+RvuXPWuguUNGeBwaZv5o+ZqbeUhAcOsUvNvAIKjHrfxeDX/qCnDjIgVixmpI5SB+Nso7WPTcksQy3MA8+sf54Wrzcg7TCSBV37UXEgYuPkpUb/KB+2px sxd4business@qq.com 17. Appendix ssh-keygen command parameter explanation

-b: specify the key length;-e: read the openssh private key or public key file;-C: add comments;-f: specify the file name to hold 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: specify the type of key to create. =

Reference address: https://www.jianshu.com/p/1246cfdbe460 reference address: https://www.cnblogs.com/whlives/p/6908125.html reference address: https://www.cnblogs.com/sxdcgaq8080/p/10570150.html

-another note-

Generate key

Ssh-keygen-t rsa-f ~ / .ssh/id_rsa-N 'password'-t specifies the key generation algorithm-f specifies the generation file, the login is carried out using the ssh command, and the default private key of his configuration file is to encrypt the private key under the home directory. SSH / id_rsa-N encrypts the private key to prevent misuse after the private key is disclosed, but this also makes it necessary to enter the password specified by-N for each login. Get the key

Cat ~ / .ssh/id_rsa.pub secret free login:

This is the end of ssh-copy-id master's article on "how to generate ssh key and obtain key in Linux system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

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