In Clouding, a PEM-encoded private key is automatically generated and assigned by default to the servers created in your account. By using these keys, it is not necessary to authenticate with the operating system user password to connect via SSH.
You can add more keys in the My SSH Keys tab and link them during server creation for use. To download them, simply go to the same section under Actions on the private SSH keys (PEM), and click the download icon to obtain it:
Connecting with the private key via SSH
On Linux and MacOS, an SSH client is installed by default. Therefore, you can specify the downloaded key as follows:
# ssh root@server_IP_address -i /path/example/default.pemYou will directly access the server without entering any password, but on Windows there is no SSH client installed by default, so one will need to be installed.
Installing the OpenSSH Client feature on Windows
You can run the following in a PowerShell with administrator privileges to install the client:
# Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
You can also do this via Windows’ “Add optional features”. Once installed, open a command prompt (CMD) or PowerShell to use the OpenSSH client:
# ssh root@server_IP_address -i "Downloads\default.pem"
In the section Add the key to the SSH agent (optional) you can also use it on Windows and add the key so it does not need to be specified repeatedly.
Another option is to use PuTTy on Windows. The article How to access SSH from Windows with PuTTy and PuTTygen explains how to use the PuTTy client with the key.
Add the key to the SSH agent (optional)
If you want to implement it and/or avoid specifying it every time you connect to the server, you can store it for the SSH client using the add option:
# ssh-add key.pemOn Windows, the SSH agent is disabled by default, and attempting to use it will display the following message:
Error connecting to agent: No such file or directory
Therefore, you need to start it. Check the agent status in a PowerShell with administrator privileges using:
# Get-Service | ?{$_.Name -like '*ssh-agent*'} | select -Property Name, StartType, Status
It will appear stopped. To start it, set the service to manual startup and start it:
# Set-Service -Name ssh-agent -StartupType Automatic ; Start-Service ssh-agent
On Linux, you will see the following message if the agent is not activated:
Could not open a connection to your authentication agent.
To activate the agent on Linux, run the following (replace bash with your shell):
# exec ssh-agent bash
When adding the key with the agent active, the following may occur:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0744 for 'llave.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
You must modify the permissions so that only the user has access:
# chmod 700 key.pem
Afterwards, you will be able to add the key:
# ssh-add .\key.pemAdditional Information
To create individual keys for server or client users, you can refer to the following article: Creating keys with ssh-keygen.
We hope this article has been helpful. If you have any questions about this or any other topic related to your servers on Clouding, write to us at soporte@clouding.io. We’re here to help! 😉