Deploying Two Linux Servers to Achieve "SSH Key Login" Tutorial
Background: Some scenarios may use two servers ssh key login. Example: automated server deployment.
Server A Linux IP：192.168.1.1
Server B Linux IP：192.168.1.2
On Server A, use the following command to generate the secret key.
If a colon (:) returns, press Enter three times. If (yes/no) appears, enter yes
ssh-keygen -t rsa
The part marked in red is the path where the file is saved.
on server A. Enter a command pointing to the IP address of server B, with the root account.
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
Then, the account password for Server B needs to be entered.
Note: If the ssh-copy-id -i command reports an error, clear the contents of the file ".ssh/authorized_keys" on Server B and retransmit the public key.