Linux Generate RSA SSH Keys

by on May 27, 2009 · 0 comments· LAST UPDATED May 27, 2010

in

How do I generate ssh RSA keys under Linux operating systems?

You need to use the ssh-keygen command as follows to generate RSA keys (open terminal and type the following command):
ssh-keygen -t rsa
OR
ssh-keygen
Sample outputs:

Enter file in which to save the key (/home/vivek/.ssh/id_rsa):
Created directory '/home/vivek/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/vivek/.ssh/id_rsa.
Your public key has been saved in /home/vivek/.ssh/id_rsa.pub.
The key fingerprint is:
58:3a:80:a5:df:17:b0:af:4f:90:07:c5:3c:01:50:c2 vivek@debian

The -t type option specifies the type of key to create. The possible values “rsa” or “dsa” for protocol version 2. The $HOME/.ssh stores the following two files:

  • $HOME/.ssh/id_rsa - Your private RSA key
  • $HOME/.ssh/id_rsa.pub - Your public RSA key

Please do not share keys file with anyone else. You can upload keys to remote server as follows:
ssh-copy-id userName@server2.nixcraft.net.in
Finally, you can login to remote server as follows:
ssh userName@server2.nixcraft.net.in
scp file.txt userName@server2.nixcraft.net.in:~/data2/

See also:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 0 comments… add one now }

Leave a Comment

Tagged as: , , , , , , , , , , , ,

Previous Faq:

Next Faq: