SSH key connection to VM

SSH key connection to Virtual Machine (VM)

Connect to Linux VM, please choose your OS type for instruction

  For Linux and Mac users - OpenSSH.
  For Windows users - PuTTY.

Generate OpenSSH key on MacOS or Linux

  SSH is used to to gain secure remote access to remote system. A key is used to gain access. You will have private key file which must remain on your host and public key file (.pub) which contents are not secret and will be copied to remote system to allow using your private key for access. You must provide public key (.pub) to us if you will use key authentication.

  The standard OpenSSH suite of tools contains the ssh-keygen utility, which is used to generate key pairs. Run it on your local computer to generate a 2048-bit RSA key pair, which is fine for most uses.


  The utility prompts you to select a location for the keys. By default, the keys are stored in the ~/.ssh directory with the filenames id_rsa for the private key and for the public key. Using the default locations allows your SSH client to automatically find your SSH keys when authenticating, so we recommend accepting them by pressing ENTER.

Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): 
Created directory '/home/user/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/user/.ssh/id_rsa
Your public key has been saved in /home/user/.ssh/
The key fingerprint is:
SHA256:n5atjy1iEhEH+TK/SL73x1YDg0qfmsdVoxhfRUKphyU user@hostname
The key's randomart image is:
+---[RSA 3072]----+
|      .o     .oo.|
|      o .   E o..|
|       +   . = . |
|      + o o = =  |
|       *So = B . |
|      o o.+++ o  |
|     o o ==o.. . |
|      + B.+++    |
|      .= ++=o    |

Add Public key in myDEAC

  Before, cat public key.

cat ~/.ssh/

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCloXnzRVi2LQVzJds3xqrmBQPOt8HOKSA8cu+CwtNd8VIfyZt597l9CiFW6eLT4lJHn66Y3nbL1RjlnVQkkav5oD4LsLrB/BTbUtYwdGJRVhy8aRKNjmnFWGkhSxBART0jCbytZPA27ijrDGPJaijW3krPyk11N6byhLqaHaJR5UzSWyr3QDhJRRSBhChYE3VaW/T3pi+IGOxT2kufFn0HNoYXnaQ1rhhmrGX1C3kxO5CLHTPPO00X0+/rB3jZqXZtqme13rPwCghCyysd5w5vojMbd8dBewSl6EjlUj9F6iyQ0CiG2nUzC0aSLgErhmdHN8ecsG03EieSzG26j7fw3LAUT1jKlbGMxLaG/bNfUnMCntEvIvWckj6nnhrW/P0VXKukpjjZiMr+imdud03ghQgrIdXIf1MBcpkKWNpZPaNPnKhObu2RiBB8zcYXIlCoj9UmLlV2AjW82oJ5proE5njXLF1CTBLayYuseU3A079zZ/4Hbx+WBX+ct+Mltqc= user@hostname

  Copy the public key content to the clipboard, and follow the steps below:

  1. In the top right corner, click on the circle(user) and select SSH Keys.
  2. Click on Add SSH key and paste the key in SSH Key section.
  3. Enter Name for SSH key and click Add SSH key.

The key will be saved

Connect to VM from your local computer

  Open terminal and run command:

ssh root@<IP_address_of_VM>

Windows connect to Linux VM using PuTTY

  To generate an SSH key on Windows, you will need to install PuTTY, both versions. PuTTY is a client for various remote access protocols, including SSH.

  You can download PuTTY from a website - link to PuTTY .Once you have downloaded the file putty-64bit-0.xx-installer.msi (“Windows Installer”), install it on your local computer following the installer instructions.

  Once the programs are installed, you can open the PuTTYgen through Start Menu or by pressing windows + R and typing:


  After that, select ECDSA at the bottom and click Generate. You’ll see the public key displayed in a text box once the key has been generated. Copy the generated key to the clipboard if you want to add the key to myDEAC profile. To add the key to your profile, please follow the steps below:

  1. In the top right corner, click on the circle (User) and select SSH Keys.
  2. Click on Add SSH key and Paste key here.
  3. Enter your Name and click Add SSH key.

The key will be saved

  When you’re finished, click the Save private key button and choose a safe place to save the key. Your key can have any name you choose, along with any extension .PPK has applied automatically.

Use Putty:

  1. Open PuTTY
  2. Add VM IP address in Session » Host Name(IP Address)
  3. Add Saved Sessions name
  4. Go to Connection » Data » Auto-login
  5. Add root username.
  6. Go to Connection » SSH » Auth » Credentials
  7. In “Private key file for authentication”, click Browse and select your saved .ppk file with key
  8. Go back to Session section
  9. Click Save
  10. And finaly click Open