Preparing Linux templates
As all Linux guests have OpenSSH Server preinstalled by default, you only need to ensure that a Linux template has cloud-init installed.
Cloud-init is required to configure user credentials and SSH access for virtual machines created from cloud images.
The easiest way to get a Linux template with cloud-init installed is to obtain it from its official repository. You can also create a Linux template from an existing boot volume.
Using cloud-init with Linux cloud images
When deploying virtual machines from Linux cloud images (for example, Debian or Ubuntu), cloud-init applies the initial system configuration.
Cloud images do not contain predefined credentials. User accounts, passwords, and SSH settings are defined through cloud-init.
Access to such virtual machines is typically provided in one of the following ways:
- by injecting an SSH key
- by specifying user credentials in a cloud-init configuration
SSH keys selected at deployment are automatically injected into the guest operating system via cloud-init.
If neither a cloud-init configuration nor an SSH key is provided, you may not be able to log in to the virtual machine.
The following example creates a user account, sets a password, and enables SSH password authentication:
#cloud-config
users:
- name: clouduser
groups: sudo
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
lock_passwd: false
ssh_pwauth: true
chpasswd:
expire: false
list: |
clouduser:<password>
runcmd:
- systemctl restart ssh
Replace <password> with a secure password.
Cloud-init configuration is provided when creating the virtual machine. For details, refer to Creating virtual machines.