SSH is often used to login from one system to another without requiring passwords.

The syntax of the ssh-keygen file is as follows:

ssh-keygen -b bits – Specifies the number of bits in the key to create. The minimum bit length is 512 bits and the default length is 2048 bits.
ssh-keygen -p – Requests changing the passphrase of a private key file instead of creating a new private key.
ssh-keygen -t – Specifies the type of key to create.
ssh-keygen -q – Quiets ssh-keygen. It is used by the /etc/rc file while creating a new key.
ssh-keygen -N – Provides a new Passphrase.

The SSH-keygen tool generate a secret key.

Step :

1) Login into a local machine.

2) Take a Terminal (Application/Accessories/Terminal)

3)  # ssh-keygen

When we enter “ssh-keygen” in terminal of local machine we get the options like below

The default path of generating the keygen is in /home/user/.ssh/id_rsa.Then press “Enter”.

4)Enter a alphanumeric passphrase you will enter will be used for encrypting your private key, if not press “Enter”.
If you want to create a passphrase type your passphrase once again to confirm it.

After the completion of this the private key is generated.The private key will be saved in .ssh/id_rsa. This file is read-only and only for you. No one else must see the content of that file, as it is used to decrypt all correspondence encrypted with the public key. The public key is save in .ssh/

5)Then public key content of local machine is then copied in file .ssh/authorized_keys of the system you wish to SSH to without being prompted for a password.

scp .ssh/ user@remote:~/.ssh/authorized_keys