Thursday, June 11, 2020

How to generate RSA Key

rsa - an old algorithm based on the difficulty of factoring large numbers. A key size of at least 2048 bits is recommended for RSA; 4096 bits is better. RSA is getting old and significant advances are being made in factoring. Choosing a different algorithm may be advisable. It is quite possible the RSA algorithm will become practically breakable in the foreseeable future. All SSH clients support this algorithm


@suthakar$pwd
/home/oracle/.ssh
@suthakar$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
cd:3c:69:fa:b3:68:a6:6a:e0:63:eb:df:a5:4c:8c:4d oracle@suthakar.prince
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|         + .     |
|      E S B      |
|  .  =   o .     |
| . .. + o        |
|  + .+ ooo.      |
| oo=o.=+. oo     |
+-----------------+
@suthakar$pwd

@suthakar$ls -ltr
total 12
-rw-r--r--. 1 oracle oinstall  392 Feb  5  2018 known_hosts_org
-rw-r--r--. 1 oracle oinstall  404 Jun 11 21:52 id_rsa.pub
-rw-------. 1 oracle oinstall 1675 Jun 11 21:52 id_rsa
@suthakar$
you will see publickey and private key.

how to check the keylength
 ssh-keygen -lf id_rsa.pub
2048 cd:3c:69:fa:b3:68:a6:6a:e0:63:eb:df:a5:4c:8c:4d id_rsa.pub (RSA)
@suthakar$
cat id_rsa.pub >>authorized_keys
@suthakar$ls -ltr
total 16
-rw-r--r--. 1 oracle oinstall  392 Feb  5  2018 known_hosts_org
-rw-r--r--. 1 oracle oinstall  404 Jun 11 21:52 id_rsa.pub
-rw-------. 1 oracle oinstall 1675 Jun 11 21:52 id_rsa
-rw-r--r--. 1 oracle oinstall  404 Jun 11 22:03 authorized_keys

scp  authorized_keys username@xxxx :/user/home/oracle/.ssh/

 

No comments: