SSH password-free login under CentOs

1. Check whether openssh is installed normally on all machines

2. Use the command   ssh - keygen  - t rsa to generate the id_rsa and id_rsa.pub keys and public keys and press Enter three times (the three carriage returns indicate the default address of the generated file ~/.ssh and no password login)

3. Go to the ~/.ssh/ directory cat id_rsa.pub  >> authorized_keys

4. Use the scp command to copy authorized_keys to the ~/.ssh/ directory of other machines

Note: 1. If there is no .ssh directory on other machines, it may be that the ssh command has not been executed after installing openssh

       2. If you want to achieve mutual SSH passwordless login between servers, execute command 2, and then execute the following command to append the public key to the authorized_keys file of other machines:

         cat ~/.ssh/id_dsa.pub | ssh 192.168.0.107 'cat - >> ~/.ssh/authorized_keys' 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327038807&siteId=291194637