The advantage of this method is that you don’t need different passwords to log on different servers. Once the public key is installed on the server, access will be granted with no password question. You can also authenticate via the personal private key on all servers, needing not to remember several passwords.
After you create two associated keys, the public key has to be stored on the remote computer host, and the private key should be stored securely on your device.
You can generate a pair of keys on a Mac using a built-in utility.
To install the public key on the server, add contents of your ~/.ssh/id_rsa.pub to the server’s ~/.ssh/authorized_keys.
When you connect to this Mac, choose the public key authentication type in connection settings and specify a private key’s location.