How Linux builds mutual trust

The origin of mutual trust:
When we frequently switch between servers, it is a torture to enter a password every time we switch between them. This leads to the concept of establishing mutual trust.

How to build mutual trust:

(1.) First, check if there is a .ssh directory under the ~/ directory. If there is no need to execute ssh-keygen –t rsa on two machines, let the two machines generate the corresponding public key id_rsa.pub under the .ssh directory And the key id_rsa and authorized_keys files.
(2.) Then copy the public key id_rsa.pub of eam1 to authorized_keys of eam2, so that no password is needed from eam1 to eam2.
In summary, there is a public key under the .ssh/ directory. Copy your public key to the authorized_keys file of the ip that you want to log in without password. You don't need a password for ssh ip again.

Summarizing the command:
However, I generally don’t use the above, I suggest to understand it. In a real environment, generally use the following command:
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub IP
can be solved with these two commands.

The following introduces a problem I encountered at work:
when backing up files on the two servers, mutual trust needs to be established, but after everything is done,
ssh IP still needs to enter a password. You can see from the picture that the permissions are mentioned. Too big cause
How Linux builds mutual trust

Then I tossed about the server I want to connect to: chmod 600 ~/.ssh/ found that it still doesn’t work, and I changed this server to use it, so I remind everyone not to be like me. The hint here means this server. File permissions under ssh/ are too large and insecure. *

Guess you like

Origin blog.51cto.com/15013163/2554861