To generate a key in Linux use ‘ssh-keygen’ command and use command line platform to run it. At the time of key generation you would be asked for a file in which the key should be saved to and for a pass phrase (password) for the key:
The commands and procedure is as follows :
[email protected]: ssh-keygen -t dsa
To Generate public/private dsa key pair.
Please enter file in which the ket has been saved for example, The full directory path as (/home/user/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_dsa.
Your public key has been saved in id_dsa.pub.
The key fingerprint is:
16:8e:e8:f2:1d:c9:b9:cf:43:9a:b3:3c:c1:1f:95:93 [email protected]
The commands will create a private key and written to /home/user/.ssh/id_dsa and a public key written to /home/user/.ssh/id_dsa.pub. The passphrase is used to protect your generated key. You will be asked for it when you connect via SSH.