For our users that get access to a single VM and not an openstack project, we tend to ask for the public part of an SSH keypair we can add to the VM so that the user can login to their virtual machine. This guide will tell you how to create this keypair. The guide applies to Linux, MacOS and Windows 10 (and above). It works for Windows, because Powershell now has a builtin SSH-client by default!)

Create the keypair

ubuntu@demo:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): <just press enter>
Enter passphrase (empty for no passphrase): <do as you please. Blank is OK>
Enter same passphrase again: 
Your identification has been saved in /home/ubuntu/.ssh/id_rsa
Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:C2KTBV9N0EP8g0VQqgo5lF629md3Fr8+z3HXBRy31ro ubuntu@demo
The key's randomart image is:
+---[RSA 3072]----+
|    .   oB++o . .|
|     + .  =... oo|
|    o =   .=  oo.|
|   o * . .. o .o |
|    X + S    .o .|
|   . * + .     +o|
|      . o o . E.=|
|         o . o o=|
|              .o=|
+----[SHA256]-----+


Get the public key (this is what we ask you to send us)

# Note the file path for "Your public key has been saved in <path>" in the example above.
# Either attach that file in an email to us, or copy the file content and add it to the mail body.


Using your SSH keypair to login

# If you just have one keypair in your .ssh folder, it will automatically be used:
ubuntu@demo:~$ ssh <username>@<hostname>

# You can also specify which keypair you want to login with:
ubuntu@demo:~$ ssh -i /path/to/private/key/id_rsa <username>@<hostname>
  • No labels