Ssh provides secure access to the remote system. The traffic between systems are encrypted using encryption algorithms. There are different encryption algorithms.
RSA is the most popular asymmetric encryption algorithm. In this tutorial we will look how to create RSA keys with
RSA algorithm is created by researchers named Ron Rivest, Adi Shamir and Leonard Adleman in the MIT. And named with their names first letters. It is asymmetric or public encryption algorithm provides a lot of flexibility. We can generate different size of keys with RSA. RSA is used to make secure SSH, OpenGP, S/MIME, SSL/TLS etc.
Generate RSA Key with Ssh-keygen
ssh-keygen will create RSA keys by default. So we do not have to specify the algorithm but in order to be sure and provide information we can explicitly specify the RSA key creation. We will use
-t option in order to specify the RSA algorithm.
$ ssh-keygen -t RSA
Generate RSA Key To Different Path
By default RSA key is generated into user home directory
~/.ssh/id_rsa . We can change this default directory during the generation or by providing the path as parameter. We will use
-f option in order to change path and file name. We will create key named
test in to the current working directory.
$ ssh-keygen -t RSA -f test
There will be two files named;
testis the private key
test.pubis the public key