It’s often more secure to establish key logins, or you may want to allow a server to automatically ssh to another to copy over backup files or to run commands. To enable SSH keys:
On the server that’s going to make the connection:
ssh-keygen -t rsa
The command above places the public key that you have to add to the accepting server in:
cd /root/.ssh/
vi id_rsa.pub
Then copy the public key onto the accepting server:
cd /root/.ssh/
vi authorized_keys
and paste in the key.
You can then test the connection by logging into the server that’s making the connection and typing:
ssh [email protected]