> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Establish SSH connection to a Virtual Machine

After you generate a pair of SSH keys and ensure that a public key is available in the Gcore Customer Portal, you can use these keys to connect to your instance.

Before you proceed with the connection steps, make sure that:

* If your Virtual Machine is only connected to a private network, it has a [floating IP address](/cloud/networking/ip-address/create-and-configure-a-floating-ip-address).
* You have set up the [necessary protocols in firewall settings](/cloud/networking/add-and-configure-a-firewall#use-the-default-firewall) to allow outgoing and incoming connections to an instance.

## Connect from terminal, command prompt, or WSL

Follow these instructions to connect to a Virtual Machine from Linux, macOS, or Windows 10/11 devices:

1\. Open Terminal (Linux, macOS), Windows Subsystem for Linux, or Command Prompt (cmd.exe on Windows OS).

2\. Connect to your Virtual Machine in one of the following ways:

* To connect using a pair of SSH keys, run the following command:

```sh theme={null}
ssh -i ~/path/to/your/private-key username@public-ip-of-your-instance
```

For example: `ssh -i ~/.ssh/id_rsa ubuntu@185.188.146.129`

* To connect with a password (only if you configured it during VM creation), run the following command and enter the password when prompted:

```sh theme={null}
ssh username@192.168.1.92. 
```

<Tip>
  **Tip**

  If you don't know your instance's username and public IP, you can check this information in the Customer Portal. Go to the "Cloud" section, select "Virtual Instances", and then open your instance. Next to the **Access to Console** link, you'll find the information in the following format: `[login]@[ip-of your-instance]`.

  Typically, the login coincides with the name of the OS. For example, `ubuntu`.
</Tip>

3\. You'll be asked to add the device to the list of known devices. Write yes to add or no to not add. Press **Enter**.

4\. You've successfully connected to the instance.

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/linux-connected.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=3c42d9640deb53974e2089fe11d9e4f5" alt="Ubuntu terminal displaying successful connection" width="2576" height="1644" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/linux-connected.png" />
</Frame>

## Connect with PuTTY

Follow these instructions to connect to a Virtual Machine from Windows 10/11 devices:

1\. Run the [PuTTY app](https://putty.org/).

2\. Open the "Session" section and enter the instance's IP address in the "HostName (or IP address)" field.

3\. Ensure that port 22 is set in the "Port" field. This is the standard port for SSH connection.

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/puttygen-session.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=333b12acbde94c0129cbb657d7b57a12" alt="Puttygen application with highlighted Port and Host name fields" width="1808" height="1800" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/puttygen-session.png" />
</Frame>

<Tip>
  **Tip**

  You can find the IP address of your Virtual Machine in the Gcore Customer Portal on the "Virtual Instances" tab. It will be displayed in the "IP Address" column.
</Tip>

4\. Make sure that the "Connection type" parameter is set to SSH.

5\. From the sidebar, go to **Connection** > **SSH** > **Auth** > **Credentials**.

6\. Select **Browse** and find your private SSH key.

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/puttygen-session-annotated.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=3e2d2b597fabe716560d390bd6482985" alt="PuttyGen application with open Credentials tab" width="2700" height="1776" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/puttygen-session-annotated.png" />
</Frame>

7\. Load the file with the private key to the Virtual Machine in the .ppk format.

8\. Select **Open** to launch the PuTTY terminal window.

9\. If you connect to the Virtual Machine for the first time, you'll be asked if you want to save the host key of your instance. Select **Accept**.

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/putty-cache-server.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=3c5b53e487af6056cfd86a3580cb8faa" alt="Putty security alert that asks to cache the server's host key" width="2692" height="1632" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/putty-cache-server.png" />
</Frame>

10\. Log in by using the following credentials:

* **login** : enter the username that was specified during the creation of your instance.
* **password** (optional): if you configured a password while creating an instance, enter your password.

<Tip>
  **Tip**

  If you don't know your instance's username and public IP, you can check this information in the Customer Portal. Go to the "Cloud" section, select "Virtual Instances", and then open your instance. Next to the **Access to Console** link, you'll find the information in the following format: `[login]@[ip-of your-instance]`.

  Typically, the login coincides with the name of the OS. For example, `ubuntu`.
</Tip>

11\. Press **Enter**.

12\. You've successfully connected to the instance.

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/putty-connected.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=4b98535ac2379f3fa721a3fdb8508195" alt="Putty terminal displaying successful connection" width="3240" height="2096" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/putty-connected.png" />
</Frame>

## Connect via OpenSSH

Windows has a built-in OpenSSH client that allows you to access the server via console, like on Linux. By default, this component is not activated. Follow these steps to activate OpenSSH:

1\. Open "Windows Settings".

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/windows-settings.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=6c6009e40040ac39c02f6a9fdeacbb43" alt="Windows settings page" width="2456" height="1288" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/windows-settings.png" />
</Frame>

2\. Go to the "Apps" section and select **Optional features**.

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/windows-optional-features.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=f8b8763bfc2e63153328e277c9e0d03b" alt="Windows Apps and features page" width="2100" height="1336" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/windows-optional-features.png" />
</Frame>

3\. Find OpenSSH Client, click to expand the detailed description, and select **Install**.

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/windows-openssh.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=557fb9e6abf511af1fcaf02c14f0e020" alt="Windows Apps and features page that displays OpenSSH Client app" width="2008" height="1632" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/windows-openssh.png" />
</Frame>

4\. After the OpenSSH client is installed, restart your computer to apply the settings correctly. OpenSSH client will become available from Command Prompt (cmd.exe).

5\. Open the Command Prompt and connect to a Virtual Machine in one of the following ways:

* To connect using a pair of SHH keys, run the following command:

```sh theme={null}
ssh username@192.168.1.92 -i ~/path/to/your/private-key username@public-ip-of-your-instance
```

* To connect with a password (only if you configured it during Virtual Machine creation), run the following command and enter a password when prompted:

```sh theme={null}
ssh username@192.168.1.92
```

<Tip>
  **Tip**

  If you don't know your instance's username and public IP, you can check this information in the Customer Portal. Go to the "Cloud" section, select "Virtual Instances", and then open your instance. Next to the **Access to Console** link, you'll find the information in the following format: `[login]@[ip-of your-instance]`.

  Typically, the login coincides with the name of the OS. For example, `ubuntu`.
</Tip>

6\. You'll be asked to add the device to the list of known devices. Write yes to add or no to not add. Press **Enter**.

7\. You've successfully connected to the instance.

<Frame>
  <img src="https://mintcdn.com/gcore/YEsPf7l6EvNuxMEL/images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/linux-connected.png?fit=max&auto=format&n=YEsPf7l6EvNuxMEL&q=85&s=3c42d9640deb53974e2089fe11d9e4f5" alt="Ubuntu terminal displaying successful connection" width="2576" height="1644" data-path="images/docs/cloud/virtual-instances/connect/establish-ssh-connection-to-an-instance/linux-connected.png" />
</Frame>
