General about SSH
The SSH protocol (also referred to as Secure Shell) is a method for secure remote login from one server to another.
Connecting to a virtual server using a key pair is more secure, then a password authentication. Key pair authentication is a method when the public part of the key is placed on the instance and the private key is placed on the user's local storage.
On all images provided by G-Core Labs Cloud, the ability to connect over SSH using a username and password is disabled by default.
To connect over SSH, make sure that in the firewall settings set all the necessary rules for incoming traffic.
SSH key pair generation
To connect to an instance, create a public key that will be stored on your instance and a private key that will be placed on your local storage.
SSH keys generation (Windows 7/8)
! SSH key generation using the command line interface (cmd) is not available for Windows 7/8 operating systems.
1. To generate key pairs, use the PuTTY and PuTTYgen apps.
2. Download and install the PuTTY package.
3. Launch the PuTTYgen app.
4. In the Type of key to generate field, specify the RSA.
5. And for the Number of bits in a generated key field, set the value to 2048.
6. Click Generate.
Important! During the key generation, move the cursor in the Key field until the key appears in the field.
7. In the Key passphrase field, enter a password.
8. Confirm the password in the Confrm passphrase field.
9. Click Save private key and save the private key.
Attention! Never pass your private key and password to third parties.
10. Click Save public key and save the public key on your local storage.
11. You can always open and copy the saved key with the Notepad app.
SSH keys generation (Windows 10, Linux OS, Mac OS)
1. To generate keys on Linux/MacOS/Windows 10:
2. Open the console, terminal (MacOS), or command line (cmd.exe fro Windows OS).
3. Run the command: ssh-keygen -t rsa -b 2048
4. Enter the key name in the Enter file in which the key should be saved field.
Attention! If you do not specify a directory (for example, .ssh/), the keys are saved in~. /<key name> (for Linux/MacOS) or in C:\Users\<user_name>\<key name> (for Windows 10).
5. Press Enter.
6. Then enter the password for the key or leave the field empty and press Enter if you want to create a key without a password.
7. Confirm the password or leave the field empty and press Enter to save the key without a password.
8. The key was created in the default directory or in the one you specified.
9. The public part of the key will be saved in the <key_name>.pub file. Use it to add it to an instance. You can open the ssh key file in text format for copying in the Notepad app.
How to manage your SSH keys in the personal account
SSH keys generation in the personal account
To create an ssh key from your personal account, follow the steps below.
1. In the G-Core Labs Cloud control panel, go to SSH Keys.
2. Click Autogenerate SSH key.
3. Enter the key name and click Create SSH key.
Important! Only Latin characters, underscores, spaces, and dots can be used. The length must be between 3 and 63 characters.
4. The key will be generated and displayed in the list of ssh keys, its public part will already be stored in the system, and the private key will be downloaded to your local storage.
5. To view the private key, find it in your local storage and open it using the Notepad app.
How to add SSH keys to your G-Core Labs Cloud personal account
To add an already created SSH key to your personal account:
1. In the G-Core Labs Cloud control panel, go to SSH Keys.
2. Click Add SSH key.
3. In the SSH key Content field, insert the public part of the SSH key.
4. Enter the key name in the Name field.
5. Click Add SSH key.
6. The key will appear in the list of SSH keys.
How to delete SSH keys in your G-Core Labs Cloud personal account
1. Select the SSH key you want to delete.
2. Click on the three-point sign.
3. Select Delete.
How to generate and add SSH keys when creating an instance
In your personal account, you can create and add an SSH key when creating an instance.
When creating an instance, in the SSH key section, you will be asked to add a key that is already stored in your personal account by selecting it from the drop-down list, add n already generated key stored in your local storage, or generate a new key here.
1. When you click Add SHH key, a dialog box opens. Add the public part of the SSH key, enter the key name to identify it in our system, and save it.
Next, select a key from the drop-down list to add it to the instance.
2. When you click Autogenerate SSH key, a dialog box opens. Enter the key Name to identify it in the system.
The key will be automatically added to the instance.
After adding or generating a new SSH key, the keys will appear in the SSH Keys section.
How to connect to an instance over SSH
SSH connection (for Windows 7/8)
!Connecting to an instance over ssh using the command line (cmd) is not available on Windows 7/8 operating systems.
To connect, use the PuTTY app.
1. Download and run the PuTTY app.
2. Go to the Session section, in the Host Name (or IP address) field enter the instance's IP address. You can find the IP address in the IP address column on the Instances page.
Important! If you create an instance with only a private address, add a floating IP. To do this, in the Instances section click on the name of the VM. In the window that opens, click Add an IP. For more information about creating floating IP addresses, see the article Networks, subnets, floating IP, firewalls.
3. In the Port field, set 22 port which is the standard port for SSH connection.
4. Next, set the Connection type field to SSH.
5. On the right side of the screen, go to Connection - > SSH -> Auth.
6. Click Browse.
8. Select the file with the private key for the instance in .ppk format.
Important! If your private key is saved in .pem format, convert it to .ppk format following the instructions.
9. Click Open.
10. The console opens.
11. In the login as field, enter the user name that was given to you when creating the instance. If your instance is created using one of the G-Core Labs Cloud images, the username is the same as the image name.
Exception! For the coreos image, the username is core, and for rancheros, the username is rancher.
12. Press Enter.
13. You have connected to your instance.
How to connect over SSH (for Windows 10, Linux OS or Mac OS)
Attention! If you use Linux OS or Mac OS, go to step 7.
Windows 10 has a built-in OpenSSH client that allows you to access the server via the console, like on Linux OS. By default, this component is not activated.
Follow the steps below to activate it.
1. Open Settings.
2. Go to the Apps section and click Optional features.
3. Find OpenSSH Client and click to expand the detailed description.
4. Click Install.
5. Wait for the installation to be completed. After SSHClient is installed, restart your computer to apply the settings correctly.
6. Then open a cmd, now ssh utility is available for it.
7. To connect to an instance over ssh, generate the private and public ssh keys, add the public key to the instance, and save the private key on the device.
8. Open the command prompt and enter the command with your own values: ssh email@example.com -i "C:\Users\username\.ssh\id_rsa":
your username ;
IP address of your instance.
Important! If you created a instance with only a private interface, create a floating IP and use it when connecting to the instance over ssh.
The path to the private key file on your computer.
The key must be in PEM format.
9. The utility will suggest adding the device to the list of known devices, write yes to add, no to not add. Press Enter.
10. You have connected to your instance.