Home  >  Article  >  Operation and Maintenance  >  What is ssh and how does it encrypt information?

What is ssh and how does it encrypt information?

齐天大圣
齐天大圣Original
2020-11-20 11:34:093433browse

In the early days, remote connection servers used clear text transmission software, such as telnet and RSH, which were later replaced by the ssh protocol. The SSH service can provide information encryption before data transmission, which greatly improves security. SSH has two main functions:

  • It can connect to a remote host and manage the resources of the host.

  • It can transfer files, similar to ftp service

SSH encryption technology

SSH uses asymmetric encryption technology. What is symmetric encryption and asymmetric encryption? Symmetric encryption, readers who want to know more about it should Google it themselves. Asymmetric encryption is mainly accomplished through public keys and private keys. The public key encrypts the information sent, and after receiving the information, the private key is used to decrypt the information.

  • Public key: The act of encrypting information sent to the other host, so your host's public key can be given to another host that wants to communicate.

  • Private key: When the remote host sends public key encrypted information 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 diagram illustrates how two hosts communicate

First, when host A wants to send information to host B, it first uses the public address of host B. The key 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. In the same way, when host B sends information to host A, it first uses host A's public key to encrypt the information, and then host A, which receives the encrypted information, uses its own private key to decrypt it.

The process of connecting to the remote host

Let’s look at how the local client connects to the remote server

  1. When the server starts the sshd service for the first time, the public key and private key are automatically generated. These files are stored in the /etc/ssh/ directory.

  2. The local host initiates a connection request to the server through terminal tools or other methods.

  3. After receiving the client's request, the server sends its public key to the client

  4. If the client has not saved the server's public key before, key, then the public key will be saved on the client. For Windows systems, the public key is stored in the C:\Users\admin.ssh\known_hosts file. If it is a Linux host, it is stored in the .ssh/know_hosts file in the home directory.

  5. The client sends its public key to the server, and the server saves the client's public key.

  6. 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 does it encrypt information?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn