To associate an SSH key with a Linux storage image of a VM, follow these steps:
Log in to the DCD with your credentials.
If a VM does not exist, drag a VM element (a Dedicated Core server, a vCPU Server, or a Cube) from the palette onto the workspace based on your needs. Else, you can choose to add storage to an existing VM.
Click + on the VM to attach storage.
Based on the need, either associate an HDD or an SSD storage by choosing one of these options: Create and attach HDD Storage or Create and attach SSD Storage.
Click Create HDD Storage or Create SSD Storage. The option differs based on the storage type you have chosen.
Result: The selected SSH key is associated with your VM.
You can connect to your VM instance using an SSH client. However, it varies depending on your operating system.
Linux: Search Terminal or press CTRL+ALT+T.
macOS: Search Terminal.
Windows: Search Bash. If you do not have it installed, use PuTTY instead.
Follow these steps to connect to your VM:
Open the terminal window on your local computer and enter the SSH connection command below. After the @
, add the IP address of your VM instance. Next, press ENTER.
For a private key, ensure that you have the location of the private key (.pem file), the username, and the public DNS name. Enter the following command:
Note: — When you log in for the first time, your local machine does not recognize the server, so you will be prompted to continue the connection. You can type yes and then press ENTER.
Authentication is the next step in the connection process. You will be able to connect to the VM immediately if you have added the SSH keys or after entering your key pair's passphrase.
If you have not already added SSH keys, you will be prompted for your password:
The terminal remains empty for you to paste the initial password into. Pasting into text-based terminals is different from desktop applications. It is also different from one window manager to another:
For Linux Gnome Terminal, use CTRL+SHIFT+V.
For macOS, use the SHIFT-CMD-V or a middle mouse button.
For Bash on Windows, right-click on the window bar, choose Edit, then Paste. You can also right-click to paste if you enable the QuickEdit mode.
Press ENTER after you enter the password.
Result: You can log in to your VM instance if the SSH key is configured correctly.
To generate SSH keys, ensure that you have ssh-keygen
command-line tool installed. ssh-keygen
is a utility for generating SSH key pairs and storing them in a secure location. With these keys, you can connect to your instances without encountering the login prompt. You can use the SSH keys on a macOS or a Linux using an SSH client.
You can manually generate SSH keys when working with a SSH client using the following:
Enter the following command into the terminal window on your computer and press ENTER.
Result: The key generation process is initiated by the command above. When you run this command, the ssh-keygen
utility prompts you for a location to save the key.
Accept the default location by pressing the ENTER key, or enter the path to the file where you want to save the key /home/username/.ssh/id_rsa
.
If you have previously generated a key pair, you may see the following prompt. If you choose to overwrite the key, you will no longer authenticate with the previous key.
Enter the passphrase that will be used to encrypt the private key file on the disk. You can also press ENTER to accept the default (no passphrase) SSH key. However, we recommend that you use a passphrase.
Enter your passphrase once more.
Result: After you confirm the passphrase, the public and private keys are generated and saved in the specified location.
— The public key is saved in the id_rsa.pub
file. Remember to upload this key to your DCD account.
— Your private key is saved in the id_rsa
file in the .ssh
directory and is used to verify if the public key you use belongs to the same DCD account.
You will receive a similar confirmation message:
You can copy the public key to your clipboard by running the following command:
When creating storages based on IONOS Linux images, you can inject SSH keys into your VM. You can access your VMs safely on the IONOS Cloud, which uses SSH keys for authentication and secure communication. SSH keys that you intend to use more often can be saved in the DCD's SSH Keys view.
Note: Connecting via SSH is only possible with the Linux operating system, not Windows, because IONOS Windows images do not support SSH key injection.
With SSH key-based authentication, you can establish secure connections to your Linux VMs. An SSH key is composed of a public-private key pair:
A private key: It stays on your local system. Ensure that you do not share your private key.
A public key: It is saved on your VM and enables you to access your provisioned VMs.
When you connect to your VM (which has the public key) using an SSH client, the remote VM validates the private key of the client. The client can access the VM only if the client has the correct private key.
SSH keys are necessary to connect via SSH. The following are the types of SSH keys that can be used for an SSH connection:
You can connect to the VM via SSH in the following ways:
Store the default SSH key in the SSH Keys view for reuse. This is not applicable for an Ad-hoc SSH key.
Attach a Linux storage image with a VM and associate either a key saved in DCD SSH keys view or an Ad-hoc SSH key with it. You can choose an appropriate SSH key by selecting the respective checkbox. An Ad-hoc SSH key must be entered manually.
Connect to your VM (Linux) instance via an SSH client of your choice. An SSH client is a collection of tools for establishing SSH connections to remote servers. Example: OpenSSH, PUTTY, etc.
Keys from the SSH Keys view
Ad-hoc SSH Keys
SSH keys that you intend to use often, either as default or non-default.
SSH keys that you only use once and do not intend to save in the SSH Keys view for reuse.
Select the Default checkbox in the SSH Keys to set them as default SSH keys.
An Ad-hoc SSH Key cannot be set as default.
Default SSH keys are preselected when you configure storage devices.
An Ad-hoc SSH Key must be specified manually.
Clear the Default checkbox if you do not want to set them as default. However, you can still associate a non-default SSH key while adding storage to a VM element.
You can specify only one Ad-hoc SSH Key when you associate a storage with the VM element.
The DCD's SSH Keys view allows you to save and manage up to 100 public SSH keys for SSH access setup. This saves you from having to copy and paste the public part of an SSH key from an external source multiple times.
In addition to the SSH keys stored in the SSH Keys view, the IONOS SSH key concept supports Ad-hoc SSH keys for Dedicated Core servers, vCPU Servers, and Cubes.
To save your SSH key in the DCD, follow these steps:
Log in to the DCD with your credentials.
Go to Menu > Management > SSH Keys.
Select + Add Key in the top left corner.
Enter a Name and click Add.
Paste the SSH key from the clipboard into the SSH key field. If you have saved your SSH key in a file, you can upload it by selecting the Choose file button in the Select Key file field.
Note: Make sure the SSH keys you enter are valid. The DCD does not validate the syntax or format of the keys.
(Optional:) Select the Default checkbox to have the SSH key pre-selected when configuring SSH access. Clear the checkbox if you do not want the key to be set as default.
Click Save to save the key.
Result: The SSH key is visible and saved in the SSH Keys view. It can be used for the configuration of SSH accesses.
To delete an existing SSH key, follow these steps:
Log in to the DCD with your credentials.
Go to Menu > Management > SSH Keys.
Select the respective SSH key from the list.
Click Delete Key.
Click OK in the Delete SSH key confirmation dialog box.
Result: The selected SSH key is deleted.