How to generate the SSH key for Linux Virtual Machine?

Meaning of SSH key

An SSH Key allows the user to login to the server without the need of a password. One should remember that an SSH key can be automatically added to the servers during the process of installation.


Steps in the Creation of an SSH key on Linux Server

  • The tools for the creation and the use of SSH are standard, and is present with most of the Linux distributions. The following command helps in generating the ssh key.
  • Run: ssh-keygen -t rsa. For a more secured 4096-bit key, run: ssh-keygen -t rsa -b 4096
  • Now you need to Press enter when it is asks for where you want to save the key.
  • Now you can enter the passphrase for the key.
  • Now Run: cat ~/.ssh/ - this will provide you with the key in a proper format to paste it into the control panel.
  • One must make sure that you need to backup the ~/.ssh/id_rsa file. This will not be able to be recovered if it is lost.

Limitations of SSH Keys

  • SSH keys are only available for Linux and FreeBSD. One must remember that it is not supported for Windows, custom ISOs neither the snapshot restores.
  • An SSH key can only be managed from a control panel during the deployment process. You will not be able to use the control panel for managing it on an already installed instance.

Connecting to a server using an SSH key from a Linux client

  • You need to check that the Linux operating system has an SSH client installed. If the client has not been installed then there is a need for installing it.
  • Initiating the connection: ssh -i /path/to/id_rsa user@x.x.x.x
  • When the session is finished then the session can be ended by pressing Ctrl+d.