Get the App
SLTechnology News&Howtos  ›  Servers  › 

Settings of ssh secret-free login between Linux servers

Shulou Source: shulou.com Published: 2022-06-02 05:16:48 11月13日 Update

Between Linux servers are the experimental steps for setting up ssh secret-free login

Environmental requirements:

Server 1VR 192.168.174.133

Server 2VR 192.168.174.134

Both servers have ssh service and openssl-clients installed

1. Generate the local public key and private key locally, and enter all the way. By default, the public key and private key are stored under .ssh in the home directory, that is, under ~ / .ssh. Of course, you can also generate your own settings. The public key is given to another server. When the server connects to another server, the other server will use the public key to pair with the private key of the server. If the match is successful, the connection is successful.

Ssh-keygen-t rsa

Send the public key to another server, enter the password of another server, and when it is successfully sent, the authorized_keys file will be generated under ~ / .ssh of the other server.

Ssh-cory-id-I / .ssh/id_rsa.pub root@192.168.174.133

View the authorized_keys file

Ssh connects to 192.168.174.133. Secret-free login is successful.

If you want to log in from 192.168.174.133 to 192.168.174.134, you need to repeat the above at 192.168.174.133.

When there are multiple servers that need to be authenticated, you can send the public key file to the same server first, then add your own public key file to this server, and then copy the authorized_keys file to the corresponding directory of other machines remotely.

Original address: https://www.linuxprobe.com/ssh-no-password.html

Tags: Service server public key file success login generation directory between original text address multiple password copy machine step environment requirement first mover local machine Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple NVidia Shulou Technology Shulou Tech Info Shulou Information