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

# Troubleshoot issues with an SSH connection

SSH connections to Gcore Virtual Machines use key-based authentication by default. Most failures trace back to a misconfigured key, the wrong default username, a missing floating IP, or a blocked firewall port.

## Recommended SSH connection method

SSH key authentication provides better security than password-based access and is the recommended way to connect to Virtual Machines.

To set up SSH key authentication:

1. Generate [SSH keys](/cloud/virtual-instances/connect/connect-to-your-instance-via-ssh#generate-ssh-keys) or use existing ones.
2. Upload the public key to the [SSH Keys](/cloud/virtual-instances/connect/connect-to-your-instance-via-ssh#add-a-public-ssh-key-to-the-customer-portal) section.
3. Select the key when [creating a VM](/cloud/virtual-instances/create-an-instance).

<Warning>
  The private key cannot be downloaded again after creation. Save it in a secure location immediately after generating it.
</Warning>

### Add multiple SSH keys

To allow multiple users or devices to access the same VM, add several keys through the [Gcore Customer Portal](https://portal.gcore.com) when creating a VM. In the **SSH key** section, select multiple keys from the saved keys list. Upload additional keys from the SSH Keys section.

## Cannot log in as root. Permission denied error

Gcore images have root SSH login disabled by default for security reasons.

The default username depends on the operating system. When creating a VM, the portal displays the correct username in the format `ssh [username]@ipaddress`.

| Operating system | Default username   |
| ---------------- | ------------------ |
| Ubuntu           | `ubuntu`           |
| Debian           | `debian`           |
| Fedora           | `fedora`           |
| CentOS           | `cloud-user`       |
| Rocky Linux      | `rocky`            |
| SUSE             | `sles`             |
| Fedora-CoreOS    | `core`             |
| Windows          | `Admin` (RDP only) |

The VM username is also available in the Customer Portal: navigate to **Cloud** > **Virtual Instances**, open the instance, and check the **Access to Console** button area where the SSH login is displayed in the format `[login]@[ip-of-the-VM]`.

After connecting with the default user, switch to root with:

```sh theme={null}
sudo -i
```

<Info>
  Custom images may have different default usernames or allow root login. Check with the image provider for the specific access credentials.
</Info>

## No password received via email

Gcore does not send VM credentials via email. By default, Virtual Machines only accept SSH key authentication.

For password access to the [VNC console](/cloud/virtual-instances/connect/connect-to-your-instance-via-control-panel), configure a [password](/cloud/virtual-instances/customize-initial-setup-for-your-instance#set-a-password-for-a-virtual-machine) during VM creation.

<Warning>
  VNC console passwords are for emergency access only. SSH key authentication is the recommended method for connecting to Virtual Machines.
</Warning>

## Lost SSH key and cannot connect

If the private key is lost:

1. If a password was configured during VM creation: access the VM via the VNC console and add a new public key to `~/.ssh/authorized_keys`.

2. If no password was configured: create a replacement VM. Save the SSH private key immediately after generation.

<Tip>
  To prevent losing access, add multiple keys to the VM during creation or use the User Data field to configure a VNC console password as a backup access method.
</Tip>

## Connection timed out

This error is caused by incorrect security group configuration.

Allow ICMP for connectivity testing:

| Protocol | Type | Code | Source    |
| -------- | ---- | ---- | --------- |
| ICMP     | Any  | Any  | 0.0.0.0/0 |

Allow TCP port 22 for SSH:

| Protocol | Port | Source    |
| -------- | ---- | --------- |
| TCP      | 22   | 0.0.0.0/0 |

The default security group includes these rules. Select the default group when creating a VM to avoid misconfiguring a custom security group.

## Permission denied (publickey) error

PuTTY and OpenSSH use different public key formats. If the public key starts with `BEGIN SSH2 PUBLIC KEY`, it will not work with Gcore Virtual Machines. The key must start with `ssh-rsa AAAA...` (OpenSSH format).

When generating a key with PuTTYgen, copy the key from the **Public key for pasting into OpenSSH authorized\_keys file** field at the top of the PuTTYgen window — do not use the text from **Save public key**.

## No floating (public) IP address. Connection refused error

When creating a VM with a pre-existing subnet, it is possible to create a server without a floating (public) IP.

Without a floating IP, SSH connections from external networks are not possible because the internal IP address is not reachable from the Internet. Add a [floating IP](/cloud/networking/ip-address/create-and-configure-a-floating-ip-address) to the VM to enable external SSH access.

## Cannot connect to a VM with Windows OS

SSH is not supported for Windows-based VMs, so use RDP (Remote Desktop Protocol) instead. On Windows PCs, the Remote Desktop client is installed by default.

## Network appliance images (FortiGate, MikroTik)

Network appliance images use their own authentication methods, not standard SSH key authentication.

| Appliance    | Default username | Default password                             |
| ------------ | ---------------- | -------------------------------------------- |
| FortiGate    | `admin`          | empty (new password required on first login) |
| MikroTik CHR | `admin`          | empty                                        |

Access these appliances via:

* **VNC console** in the Customer Portal
* **Web interface** (FortiGate: `https://[VM-IP]`, MikroTik: `http://[VM-IP]`)
* **SSH** (after initial configuration via console)
* **WinBox** (MikroTik only)
