3.3 Connecting to your virtual machine

3.3.1 Keypair based SSH connection

When your virtual machine has a public Floating IP assigned in cPouta cloud (or VM local IP in case of ePouta) and a security group that allows SSH, you can open a remote SSH connection into your instance. Any standard SSH client should work. More details about SSH based terminal connections are available in the terminal connections section of the CSC Computing environment user guide.

A new virtual machine will only have a default user account and the root or administrator account or in some cases only the root account. The user account name depends on the image used. For images provided by CSC it has usually been "cloud-user" but we are moving towards using the images upstream defaults for example ubuntu 18 uses "ubuntu". You can only log in using keypair based authentication, such as:

#for cPouta VMs
ssh cloud-user@public-ip -i keyfile.pem
#for ePouta VMs
ssh cloud-user@vm-ip -i keyfile.pem

With the default CSC images when you try logging in as root, you will get a message that tells you what username to use instead. Some third party images may use the root account directly, or a completely different username.

You can also use an SSH agent instead of the command above. With an SSH agent, you will be able to have one machine with a public IP, and connect via SSH to the other machines from that machine, without having public IPs for all machines. To use an SSH agent in your local Linux or Mac OS X machine, start a shell and run commands:

ssh-agent /bin/bash
ssh-add ~/.ssh/keyname.pem

Now you should be able to connect using SSH to the public Floating IP of your VM in cPouta (or VM local IP in case of ePouta). The public IP and private IP of your VMs are visible in the web UI if you are unsure what they are. Once the key has been loaded, you can use SSH agent as follows: 

#for cPouta VMs
ssh -A cloud-user@public-ip
#for ePouta VMs
ssh -A cloud-user@vm-ip

The difference is that you are no longer specifying the key to use using -i since this comes automatically from the agent. The -A option stands for agent forwarding. It allows you to use the host with the public Floating IP as a jump host, i.e. connect to other VMs reachable by the jump host that allow this particular key. Please note that key forwarding transfers your private key to the remote host. This may not be acceptable in some environments or security policies.

Before connecting to your virtual machine, you can check its status from the Instances view of the cPouta/ePouta web interface.

Figure 3.5 Instances view of the cPouta web interface.

Figure 3.5 shows a sample of the Instances view in cPouta web interface. In this case we can see that virtual machine called a-dummy-instance is active and running. The machine has two IP addresses of which address 86.50.169.111 is the public one. The machine uses a keypair called risto.

ePouta web interface looks similar, but instances in ePouta have only one IP address field specified which is the virtual machine's local IP.

3.3.2 Getting root access on a virtual machine

If you logged in using a default user account, you will be able to run commands as root with sudo like so:

sudo <some command>

You can also get a root shell like so:

sudo -i

None of the accounts in the default images provided by CSC have password login enabled. In these images, you can utilize sudo without a password. If accounts that do not have root access are needed, those need to be created separately.

3.3.3 Connect to a machine using the Pouta virtual console

The web interface includes a console tool that you can use to login to your virtual machine directly. However, when using CSC provided images, using the console requires you to create a user account with a password into the virtual machine.

You can open a console session by clicking Console from the instance dropdown menu:

To input text into the console click the grey bar as shown:

After this you can login with the user account and password you have created.

Please Note: Umlaut characters don't work in the virtual console for most keymaps.

Previous chapter   One level up   Next chapter