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

Configure a trust relationship between two Linux machines (and how to undo it)

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

Share

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

Suppose the following scenario: to achieve password-free login of CVM A to CVM B, the main steps are as follows:

1) using "ssh-keygen-t rsa" in host A to generate the corresponding private key and public key (id_rsa and id_rsa.pub).

2) add your own private key to CVM A: ssh-add id_rsa

Note: the second step is missing in many introductions, so it is common to fail the test.

Ssh-add id_rsa

# if prompted by could not open a connection to your authentication agent

The terminal does the following:

Ssh-agent bash

Ssh-add id_rsa # enter password

3) copy the public key id_rsa.pub from host A to the .ssh directory of host B and cat id_rsa.pub > > authorized_keys.

4) change the authorized_keys in host B to only the current user has read and write permissions: chmod 600authorized_keys

In this way, host A can avoid logging in to host B.

But how to break the trust relationship between the two machines? In fact, it is very simple. It is not possible to delete the key. You can do this on host A (1) cd ~ / .ssh (2) vi known_hosts (3) delete the line about host B in known_hosts.

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