In the early days, the remote connection server used plaintext transmission software, such as telnet and RSH, and later they were all replaced by the ssh protocol. The SSH service can provide information encryption and then transmit the data, which greatly improves the security. SSH has two main functions:
-
Ability to connect to remote hosts and manage host resources
-
Able to transfer files, similar to ftp service
SSH encryption Technology
SSH uses asymmetric encryption technology. Readers who want to know more about symmetric encryption and asymmetric encryption, please Google. Asymmetric encryption is mainly accomplished through the public key and private key. The public key encrypts the information sent, and after receiving the information, the private key is used to decrypt the information.
-
Public key (Public key): The act of encrypting the information sent to the host of the other party, so your host public key Can be given to another host that wants to communicate.
-
Private key (Private key): When the remote host sends the information encrypted with the public key to the current host, the current host uses its own private key to decrypt the information . Remember, your private key must not be known to other hosts.
The following diagrams illustrate how two hosts communicate
First, when host A wants to send information to host B, use The public key of host B encrypts the information to be sent. When host B receives the encrypted information sent by host A, it uses its own private key to decrypt the information. Similarly, when host B sends information to host A, it first encrypts the information with the public key of host A, and then host A, which receives the encrypted information, decrypts it with its own private key.
The process of connecting to a remote host
Let’s look at the local client How to connect to a remote server
-
When the server starts the sshd service for the first time, it will automatically generate a public key and a private key. These files are stored in the /etc/ssh/ directory.
-
The local host initiates a request connection to the server through a terminal tool or other methods.
-
After receiving the client request, the server sends its own public key to the client
-
If the client did not have Save the public key of the server, then the public key will be saved on the client. For the windows system, the public key is stored in the C:\Users\admin.ssh\known_hosts file, and for the linux host, it is stored in the .ssh/know_hosts file in the home directory.
-
The client sends its public key to the server, and the server saves the client’s public key.
-
The client and server communicate.
For more related technical articles, please visit the Linux System Tutorial column!
The above is the detailed content of what is ssh and how it encrypts information. For more information, please pay attention to other related articles on 1024programmer.com!