ssh-keygen or ssh-keygen -t rsa – 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):
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 vive k@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/