How to generate SSH key and establish SSH connection to server

How to generate SSH key and establish SSH connection to a server on hosts like SiteGround:

  1. Open Puttygen, make sure RSA is selected from the Parameters section, then click Generate to generate a new key pair.
  2. Move mouse over the blank area to generate randomness to create the key.
  3. When key is generated, give it a comment and then a passphrase (password). Then save the public key and private key to two files using the respective buttons.
  4. Go to SiteGround (or other host) user interface, under Dev > SSH Keys Manager, select Import.
  5. Write something recognizable for Key Name, and then copy the public key from inside Puttygen, from the area at the top that says “Public key for pasting into OpenSSH authorized_keys file”.
  6. Click Import and you should have the public key imported into the server now. Click the options next to the key and select SSH Credentials.
  7. Open Putty and enter the credentials:
    1. In the Session menu, enter Hostname and Port.
    2. In the SSH > Auth menu, enter the path to the private key you saved earlier.
    3. In the Connection > Data menu, enter the “Auto-login username” from the SiteGround SSH Credentials.
    4. In the Session menu, in Saved Sessions, enter a recognizable name for this saved connection. Then click Save.
    5. Click Load and you will be prompted to enter the private key passphrase (password). The very first time you connect, Putty will alert you you’re connecting to a new server and if you are sure this is the right server, you can select to trust it in the future.