The Gcore Customer Portal is being updated. Screenshots may not show the current version.
Chosen image
Home/Cloud/Bare metal servers/Connect to your bare metal server via SSH

Connect to your bare metal server via SSH

You can connect to an instance or a bare metal server using a pair of SSH keys or a password. We tell you in detail about each method.

The SSH protocol (also referred to as Secure Shell) is a method for secure remote login from one server to another. To connect via SSH, make sure that all the necessary rules for incoming traffic are in the firewall settings set.

Please note: you cannot connect to Windows instances via SSH. But you can connect to them via RDP protocol or from the console in the Customer Portal. Linux machines can be accessed via SSH or from the Customer Portal.

Connect with SSH keys

To connect to an instance or a bare metal server, create a public key that will be stored on your machine and a private key that will be placed on your local storage.  

Generate a key (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 PuTTY and PuTTYgen.

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 "Confirm passphrase" field. 

9. Click Save private key and save the private key. 

Attention! Never share your private key or password with 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.  


Generate a key (Windows 10, Linux OS, macOS)

1. To generate keys on Linux/macOS/Windows 10: 

2. Open the console, terminal (macOS), or command line (cmd.exe for 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~. / (for Linux/macOS) or in C:\Users\\ (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 .pub file. Use it to add it to your machine. You can open the ssh key file in text format for copying in the Notepad app. 

Generate a key in the personal account

To create an SSH key from your personal account, follow the steps below. 

1. In the Gcore Customer Portal, 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.   

Add a key to your account

To add an already created SSH key to your personal account: 

1.  In the Gcore Customer Portal, 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. 

Delete a key

1. Select the SSH key you want to delete. 

2. Click on the three-point sign.  

3. Select Delete. 


Generate a key when creating an instance

In your personal account, you can create and add an SSH key when creating an instance or Bare Metal server. 

When creating a machine, 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 an 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 your machine.  

 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 your machine.  

After adding or generating a new SSH key, the keys will appear in the SSH Keys section. 


Connect with a password

To connect using a password, configure it while creating an instance or a bare metal server. In Additional options click on "User data". This will open a field, where you can enter the script that will be processed by a cloud-init agent running on your machine. 


Paste the code below with the password chosen by you:

password: **your password**  
chpasswd: { expire: False }  
ssh_pwauth: True

Using the specified password, you will be able to connect to the instance or Bare Metal server via SSH or from the Customer Portal.

It is not necessary to specify the password explicitly, you can enter its hash (the same password, only in a converted form; the system will be able to read it, but for a person, it looks like a random set of symbols). Then, even if someone gets into the system, he or she won’t know the password — only the hash will be stored inside. And the system will open its doors only to the user who knows the password. To generate a hash, you can use the Python script:

#!/usr/bin/env python3  
\# based on [https://stackoverflow.com/a/17992126/117471](https://stackoverflow.com/a/17992126/117471)  
\# pip3 install passlib  
import sys  
from getpass import getpass  
from passlib.hash import sha512_crypt  
passwd = input() if not sys.stdin.isatty() else getpass()  
print(sha512_crypt.hash(passwd , rounds = 5000 ))

Connect via SSH

Connect from Windows 7/8

!Connecting to an instance or a bare metal server 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 machine's IP address. 


Important! If you create a machine with only a private address, add a floating IP.


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. (Step for connecting using a pair of SSH keys only) on the right side of the screen, go to Connection - > SSH -> Auth. 

6. (Step for connecting using a pair of SSH keys only) click Browse. 


7. (Step for connecting using a pair of SSH keys only) select the file with the private key for your machine in .ppk format.  

Important! If your private key is saved in .pem format, convert it to .ppk format using the article Convert an SSH key from PEM to PPK.

8. Click Open. The console will open. 


9. In the "login" field, enter the user name that was given when creating the instance or bare metal server. You can find it in the instance's tab, you will see is an inscription of the "[login]@[IP of your machine]" type. Most often, the login coincides with the name of the OS. For example, for the machine below it is "Ubuntu".

10. (Step for connecting using a pair of SSH keys only) enter the password you configured while creating an instance or Bare Metal server.

11. Press Enter.   You have connected to your machine.  

Connect from Windows 10, Linux OS, macOS

Please note: If you use Linux OS or macOS, 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 SSH Client is installed, restart your computer to apply the settings correctly. SSH utility will become available for cmd. 

6. Open the command prompt.

If you want to connect using a password, enter the command:

ssh username@

If you want to connect using a pair of SHH keys, enter the command:

ssh username@ -i "C:\\Users\\username\\.ssh\\id_rsa

Replace "username" with your username, which can be found on the the right-hand side of the "Access to Console" button. Additionally, replace " with the IP address of your instance, and replace "C:\Users\username\.ssh\id_rsa" with the path to your private key file in PEM format on your computer.
Important! If you created an instance with only a private interface, create a floating IP address and use it when connecting to the instance over ssh.

7. The utility will warn you that you're trying to connect to an unknown device and ask if you want to continue. Type "yes" and press Enter. 


8. (Step for connecting using a password only) enter the password you configured while creating an instance or a bare metal server.

You have connected to your machine.

Was this article helpful?

Not a Gcore user yet?

Discover our offerings, including virtual instances starting from 3.7 euro/mo, bare metal servers, AI Infrastructure, load balancers, Managed Kubernetes, Function as a Service, and Centralized Logging solutions.

Go to the product page