The full name of SSH is Secure SHell. By using SSH, you can encrypt all transmitted data, making "man-in-the-middle" attacks impossible, and also preventing DNS and IP spoofing. An additional benefit is that the transmitted data is compressed, so the transmission speed can be accelerated. SSH has many functions. It can replace telnet and provide a secure "channel" for ftp, pop, and even ppp. SSH was originally developed by a company in Finland. However, due to copyright and encryption algorithm restrictions, many people now use OpenSSH OpenSSH is an open source version of the SSH protocol (SSH: Secure SHell). Today I will introduce how to install OpenSSH in Windows and generate keys using the ssh-keygen command; 1. Download OpenSSH 2. Install OpenSSH 1. Language selection: Chinese and English are both acceptable Next step "Accept Agreement" to continue Here, because we are using SSH to connect to Linux, we only need the client, and cancel the "Server" option. Complete openssh installation under Windows 3. Test whether SSH is installed successfully Enter the windows command line tool, enter the ssh command, and the following information appears, indicating that our installation is successful 4. Use the ssh-keygen command to generate a key pair (public key and corresponding private key) The specific parameters of ssh-keygen are as follows:
The parameters we commonly use are basically the following: -t: Specifies the type of key to create. You can use: "rsa1" (SSH-1) "rsa" (SSH-2) "dsa" (SSH-2); the default is RSA -b: Specifies the key length. For RSA keys, the minimum requirement is 768 bits, and the default is 2048 bits. DSA keys must be exactly 1024 bits (a requirement of the FIPS 186-2 standard). -f : Specify the key file name -C: Specify key comment Enter "ssh-keygen -t rsa -b 4096 -C "192.168.1.1"" in the command line tool. The following information is prompted. Here I set the key bit number to 4096. The default is 2048. Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Administrator>ssh-keygen -t rsa -b 4096 -C "192.168.1.1" Generating public/private rsa key pair. Enter file in which to save the key (/home/Administrator1/.ssh/id_rsa): key #Enter the file name here. Windows requires input. If you do not enter it, an error will occur. Enter passphrase (empty for no passphrase): #Enter the key passphrase, which can be understood as the key password. You do not need to enter it. Enter same passphrase again: #Enter the key password again. Your identification has been saved in key. Your public key has been saved in key.pub. The key fingerprint is: SHA256:Ke9MH5QsT19TJqQgimryAn27Vp+MuIFeIff/2VL6hQE 192.168.1.1 The key's randomart image is: +---[RSA 4096]----+ | . . . | | . . . . o | | . . E . . o| | . . oo + | |o = + . S = . o | |.+ = +.o = ..+ . | |. o +o.+o.ooo . | | o .oo.=+.o+ . | | ..o. +.+oo | +----[SHA256]-----+ C:\Users\Administrator> After completion, open the current user directory to see if there is a key file that has just been generated. In fact, there should be two files. key is the private key and key.pub is the public key. My current user directory is "C:\Users\Administrator", which may be different from yours 5. Linux server SSH settings After generating the key pair, you also need to upload the public key, the key.pub file we just generated, to the Linux server Note: The upload location is the .ssh directory in the home directory of the user we log in to Linux If the directory does not exist, you need to create the ~/.ssh directory and set the directory permissions to 700). Rename the public key to authorized_keys and set its user permissions to 600 For example: Then rename the key.pub file we uploaded to: [root@server ~]# mv key.pub authorized_keys [root@server ~]# chmod 700 .ssh [root@server ~]# chmod 600 authorized_keys OK, now you can use SSH keys to connect to the Linux server If you fail to connect, please check that the permissions on the .ssh directory and the authorized_keys file are correct. For more articles about SSH connection to Linux server, please check the following related articles You may also be interested in:
|
>>: Detailed explanation of Vue's seven value transfer methods
Table of contents 1. Implementation of counter 2....
NULL and NOT NULL modifiers, DEFAULT modifier, AU...
1. Introduction The difference between row locks ...
Table of contents 1. Problem Discovery 2. View de...
Preface Let me share with you how I deployed a Sp...
Without further ado, let's get straight to th...
Recently, when running an old RN project, the fol...
This article uses examples to describe common ope...
Table of contents Overview Solution 1: Closures S...
Question 1: How do you instruct the browser to dis...
Record the installation and configuration method ...
1. What is responsive design? Responsive design i...
What does linux cd mean? In Linux, cd means chang...
This article shares the specific code of vue elem...
Preface In case of application bug or DBA misoper...