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 configure ssh mutual trust in linux

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Linux how to configure ssh trust, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.

The basic idea of public key authentication:

The encryption and decryption of information use different keys, which are called private key and public key respectively, where the public key is stored on the server to be logged in, and the private key is held by a specific client. When the client sends a request to the server to establish a secure connection, it first sends its own public key. If this public key is allowed by the server, the server sends a random data encrypted by the public key to the client. This data can only be decrypted by the private key. The client returns the decrypted information to the server. After the server verifies that it is correct, it confirms that the client is trustworthy, thus establishing a secure information channel. In this way, the client does not need to send its own identity token "private key" to achieve verification purposes, and private key cannot be inferred from public key. This avoids password leaks that could result from network eavesdropping. Clients need to be careful to keep their private keys private so that others don't steal them, and once this happens, servers need to change their trusted public key lists.

The steps to configure SSH trust are as follows:

1. First, on the machines to be configured with mutual trust, generate their own authenticated key files;

2. Secondly, all the key files are summarized into a total authentication file;

3. Distribute the authentication file containing the authentication keys of all mutual trust machines to each machine;

4. Verify mutual trust.

Create ssh trust on hostnames node1, node2, node3 with the same user test.

1. Create RSA keys and public keys on each node

Log in with test user

mkdir ~/.ssh

chmod 700 ~/.ssh

cd ~/.ssh

ssh-keygen -t rsa

2. integrate public key file

Execute the following command on node1

ssh node1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

ssh node2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

ssh node3 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

chmod 600 ~/.ssh/authorized_keys

3. Distribute the consolidated public key file

Execute the following command on node1

scp ~/.ssh/authorized_keys node2:~/.ssh/

scp ~/.ssh/authorized_keys node3:~/.ssh/

4. Test SSH mutual trust

Run the following command on each node to display the current date of the system without entering a password, indicating that SSH trust has been configured successfully.

ssh node1 date

ssh node2 date

ssh node3 date

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

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

Servers

Wechat

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

12
Report