Implement ssh login-free secret between the host

1. Requirements:

  • A machine user has a, the user wants to be able to achieve this by logging Free adhesion using ssh tool B, C, etc.

2. Use the command example:

[tomandersen@hadoop101 .ssh]$ ssh-keygen -t rsa
[tomandersen@hadoop101 .ssh]$ ssh-copy-id tomandersen@hadoop102

3. The specific implementation steps:

1) Create a folder .ssh

  • Free to be implemented into the dense logged-in user's home directory, this experiment is / home / tomandersen, use ssh tool to connect the machine, then it would create the .ssh folder in this path
[tomandersen@hadoop101 ~]$ cd ~
[tomandersen@hadoop101 ~]$ ssh localhost
Last login: Sat Feb  8 20:25:27 2020 from localhost

Create a folder .ssh

2) generating public and private keys

  • Entering .ssh folder id_rsa.pub generate public and private key encryption algorithm rsa id_rsa using ssh-keygen command
[tomandersen@hadoop101 .ssh]$ ssh-keygen -t rsa

Generate a public key and a private key

3) sends the public key to the user on the specified host

  • Use ssh-copy-id command sends the public key to create a user needs to log on the remote host, in fact, it is know_hosts end of the file under its user .ssh directory add public key cryptography
[tomandersen@hadoop101 .ssh]$ ssh-copy-id tomandersen@hadoop102

Sends the public key

  • Because before had been sent, so the displayed file already exists

4) test is successful

End~

Published 15 original articles · won praise 5 · views 10000 +

Guess you like

Origin blog.csdn.net/TomAndersen/article/details/104227687