To increase the security of your instance/virtual machine, it is worth using the possibilities offered by SSH keys. This solution allows you to authenticate yourself on a server - where the public key is located - using the private key - which is present on the user’s computer. The e24cloud platform provides 2 options for using this functionality - generating a key from the panel or uploading your own key.
If we want to generate a key via the Customer Panel, we click on Tools > SSH Keys, and then on the Add Key button.
Then we select the Generate option and click the Create button.
Generating a key from the panel will result in the private key appearing in text form after a while - it must be copied to a file on the computer’s disk - we will use it later to log in to the instance/virtual machine.
To generate a key pair on Linux or OSX systems, we execute the following commands.
# ssh-keygen -b 4096
Information about generating a key pair will appear, and we will be asked where to save it.
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/Username/.ssh/id_rsa):
To generate a key pair on Linux or Windows systems, we will use the PuttyGen program.
After starting PuttyGen, click the Generate button, and then we must move the mouse cursor in a designated area to collect random data on which the keys will be generated.
After generating the key, we should select the text in the designated field and save it to a file.
After entering the location of the key pair - private and public - will be created. The next step is to upload the public key to the Customer Panel. Click on Tools > SSH Keys, and then on the Add Key button.
In the form that appears, we give our key a name, and then select the option Import your own key.
We import the key by pasting its contents or selecting the appropriate file from the disk (the key file should have the extension .pub
).
After submitting the form with the Create button, the appropriate entry should appear on the list of keys.
The next step is to use the created keys in practice. We will create an instance of Ubuntu 22.04, on which we will load the private key created a moment ago. Click on Servers > e24cloud Servers, and then on the Add server button. In the form, we select the Ubuntu 22.04 system and choose the key we created in the panel from the list.
From the information in the panel, it follows that the key will be assigned to the e24
user - so we log in to this account.
# ssh -i /home/Username/.ssh/id_rsa e24@server_ip
If all actions were performed correctly, the authentication should proceed successfully.