To create your public / private key on Linux or Mac, which is a unix-based system, following these steps:
- Open terminal
- type the following commandssh-keygen -t rsa
- Type enter to ignore passphrase twice
By default you keys will be saved in ~./ssh directory. id_rsa is the private key. id_rsa.pub is the public key. Place a copy of your public key on systems you wish to login through you key pair.
Copying public key to server
If you copy your public key to your server, you would be able to login without having to type in your password. To copy your public key to the server, type the following command:
cd ~/.ssh
cat id_rsa.pub | ssh username@remoteserver 'cat >> .ssh/authorized_keys';
Replace username with your login. Replace remoteserver with your server name or ip.