Skip to content

⚡ Connect to your virtual machine

Summary
This tutorial shows you how to connect to an existing virtual machine from Linux, macOS or Windows using SSH.
Internet
https://en.wikipedia.org/wiki/Secure_Shell
flowchart LR
    A(Launch Terminal / Powershell<br>or PuTTY) --> B{Using<br>CLI}
    B -->|Yes| C(Execute <code>ssh</code> command from the terminal)
    B -->|No| D(Convert private SSH key to PPK format)
    D --> E(Create an SSH connection from PuTTY)
    E --> F(Use the Linux virtual machine)
    C --> F

Prerequisites

  1. An existing virtual machine (in cPouta) that is connected to the Internet.

🟩 Procedure

Connecting to a virtual machine in cPouta is done via an SSH connection. The connection can be made from the command line or using a graphical client such as PuTTY (for Windows).

Info

Following example values (key name, ip address, etc.) come from the tutorials: Create an SSH key pair and Connect your virtual machine to the Internet via the web.

Connecting to the virtual machine from a Linux, macOS or Windows PowerShell command line is easy with an ssh command:

ssh -i <your-private-key> -l <username> <ip-address>

Note

If you are using CSC's official images, you can check the default username using this link: Images - Docs CSC. For example, for Ubuntu flavours, the default username is ubuntu as in example below.

Below is an example of a successful first login.

Terminal
$ ssh -i linux-course-ubuntu-access-key.pem -l ubuntu 128.45.253.78
The authenticity of host '128.45.253.78 (128.45.253.78)' can't be established.
ED25519 key fingerprint is SHA256:zWQQRHr+hi+rFwrncxA8ImH7TrxMSLS0/t2Slj3wx9A.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '128.45.253.78' (ED25519) to the list of known hosts.
Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 5.15.0-91-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sat Dec  6 08:23:44 UTC 20xx

  System load:  0.0               Processes:             88
  Usage of /:   2.6% of 77.35GB   Users logged in:       0
  Memory usage: 26%               IPv4 address for ens3: 192.168.1.10
  Swap usage:   0%

 * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
   just raised the bar for easy, resilient and secure K8s cluster deployment.

   https://ubuntu.com/engage/secure-kubernetes-at-the-edge

Expanded Security Maintenance for Applications is not enabled.

15 updates can be applied immediately.
To see these additional updates run: apt list --upgradable

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


*** System restart required ***

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@ubuntu-24:~$ ▁

And the same from the PowerShell view.

Successful login with PowerShell

That's it!

Now you can start working with your Linux machine.

PuTTY for Windows

There are several clients that can be used to make an SSH connection from Windows, PuTTY being one of the more widely used.

You can download it from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html.

Tip

Please download the msi installer package as it contains the PuTTYgen tool needed to convert the private key to the supported format.

Launch the PuTTYgen and select 'Load an existing private key' 1⃣. Browse to your private SSH key and open it.

Acknowledge the notice and click OK 2⃣.

Save the private key 3⃣ in the ppk file format.

PuTTYgen in action

Next, start PuTTY. A configuration view will open. Note the 'Session' and 'Credentials' 4⃣ in the left-hand menu.

In the Session View, you can define the virtual machine's connection details 5⃣.

Make sure that you have entered the

  • user name
  • Host Name or the public IP address
  • Connection type (SSH)

PuTTY in action

Then, from the left-hand menu, select Connection -> SSH -> Auth -> Credentials and click the 'Browse...' 6⃣ button.

Select your private SSH key in the ppk format that you created earlier.

Click Open 7⃣ to connect to the virtual machine.

PuTTY and ppk formatted key

That's it!

Now you can start working with your Linux machine from Windows environment.

A successful login view from PuTTY.

Successful connection with remote machine

Further Learning

Here are some suggestions for what to read next: