> ## 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

## Recommended SSH connection method

SSH key authentication is the recommended way to connect to Bare Metal servers because it is more secure than password authentication.

To set up SSH key authentication:

1. [Generate](/cloud/virtual-instances/connect/connect-to-your-instance-via-ssh#generate-ssh-keys) an SSH key pair, or use an existing one.
2. Add the public key to the [Customer Portal](/cloud/virtual-instances/connect/connect-to-your-instance-via-ssh#add-a-public-ssh-key-to-the-customer-portal).
3. Select the key on the Bare Metal [creation form](/cloud/bare-metal-servers/create-a-bare-metal-server).

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

### Add multiple SSH keys to a resource

To allow multiple users or devices to access the same server, add several SSH keys through the Gcore Customer Portal on the Bare Metal [creation form](/cloud/bare-metal-servers/create-a-bare-metal-server). In the **SSH key** section, select multiple keys from the saved keys list.

Additional public keys can be added to the [Customer Portal](/cloud/virtual-instances/connect/connect-to-your-instance-via-ssh#add-a-public-ssh-key-to-the-customer-portal) at any time.

## Cannot log in as root. Permission denied error

Gcore images disable root SSH login by default for security.

The default username depends on the operating system. When creating a server, 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`       |
| Fedora-CoreOS    | `core`             |
| Windows          | `Admin` (RDP only) |

The server username also appears in the [Gcore Customer Portal](https://portal.gcore.com): navigate to **Cloud** > **Bare Metal**, open the server, and check the label next to **Access to Console** in the format `[login]@[ip-of-the-server]`.

After connecting with the default user, switch to root:

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

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

## No password received via email

Gcore does not send server credentials via email. By default, Bare Metal servers accept SSH key authentication only.

To configure password access for the [portal console](/cloud/virtual-instances/connect/connect-to-your-instance-via-control-panel) or SSH, set a password during server creation:

* **Linux servers** — add a [cloud-init password script](/cloud/bare-metal-servers/connect-to-your-bare-metal-server-via-ssh#connect-with-a-password) in the **User data** field.
* **Windows servers** — enter the password in the access section of the [creation form](/cloud/bare-metal-servers/create-a-bare-metal-server).

<Warning>
  Console passwords are for emergency access only. SSH key authentication is the recommended method for connecting to Bare Metal servers.
</Warning>

## Lost SSH key and cannot connect

If the private SSH key is lost:

1. **If a password was configured during server creation:** Access the server via the [portal console](/cloud/virtual-instances/connect/connect-to-your-instance-via-control-panel) and add a new public key to `~/.ssh/authorized_keys`.

2. **If no password was configured:** Reinstall the server with a new SSH key.

<Tip>
  To prevent losing access, add multiple SSH keys during server creation or configure a console password as a backup access method.
</Tip>

## Incorrectly added SSH key. Errors: Connection refused

PuTTY and OpenSSH use different public key formats. A key in `BEGIN SSH2 PUBLIC KEY` format does not work — the key must start with `ssh-rsa AAAA...` or another OpenSSH prefix.

When generating a key with PuTTYgen, copy the OpenSSH format from the **Public key for pasting into OpenSSH authorized\_keys file** field.

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

A server created on a private-only subnetwork has no public IP address.

SSH from external networks requires a routable address. Attach a [floating IP](/cloud/networking/ip-address/create-and-configure-a-floating-ip-address) to the server for external SSH access.

## Cannot connect to a Windows server

A connection error when targeting a Windows server usually means the wrong remote access protocol was selected. Windows servers do not accept SSH connections.

Use RDP (Remote Desktop Protocol) instead. On Windows PCs, the Remote Desktop client is installed by default. For browser-based console access, use the [Customer Portal](/cloud/virtual-instances/connect/connect-to-your-instance-via-control-panel).
