SSH-keys are useful when authenticating via SSH to a server. Keys are generally a lot more secure than using plain-text passwords.
To generate a key, type in the following command.
You can append the -c flag to the command to add a comment to the key (useful if using several keys).
The generator will ask you to enter a path where the key should be stored. Just press enter to use the default one (if this is a second key, you should set the path to something else).
It will also ask you to set a password. It’s strongly recommended to set a password.
Your key is now generated. To use the key for SSH authentication, you will need to add it to your ssh-agent.
Start the agent if it’s not already running.
Then add the key to the agent. Replace filename id_rsa if you set it to something else earlier.
Congratulations! You now have a working SSH key.