# Connect a cloud server

Source: https://openpanel.sh/docs/servers/cloud-server

Prepare a server at Hetzner, DigitalOcean, OVHcloud or Scaleway for OpenPanel, including one created with an SSH key and no password.

Any cloud provider works. The quickest way is [One command](/docs/servers#one-command): create the server, sign in to it with SSH as you normally do (an SSH key is fine), and run the install command the console shows. No password and no firewall rule are needed, since the agent only connects out.

This page covers the [SSH setup](/docs/servers#connect-over-ssh), where OpenPanel signs in with a password and hardens the server. The server must run Ubuntu Server 22.04 or 24.04 LTS, and the parts that differ between providers are getting a password and opening the ports in the provider's firewall.

## Before you start [#before-you-start]

- A new server with **Ubuntu 24.04 LTS** (22.04 LTS works too), nothing else installed. See [Requirements](/docs/servers/requirements).
- Its **public IPv4 address**, from the provider's control panel.
- If the provider has a firewall in front of the server, it must let in **TCP on the SSH port** (usually 22) and **TCP 20000 to 60000**. The setup moves SSH to a random port in that range.

## 1. Create the server [#1-create-the-server]

<Tabs items={["Hetzner","DigitalOcean","OVHcloud","Scaleway"]}>
<Tab value="Hetzner">
In the Hetzner Cloud Console, create a server with the **Ubuntu 24.04** image.

- **Without an SSH key**, Hetzner emails you the root password. Use `root` and that password.
- **With an SSH key**, you get no password. Set one as in [Servers created with an SSH key](#servers-created-with-an-ssh-key).

If you attach a **Firewall**, add inbound rules for TCP on port 22 and TCP 20000–60000.
</Tab>

<Tab value="DigitalOcean">
Create a Droplet with the **Ubuntu 24.04 (LTS) x64** image. Under **Choose Authentication Method**:

- **Password**: you choose the root password. Use `root` and that password.
- **SSH Key**: you get no password. Set one as in [Servers created with an SSH key](#servers-created-with-an-ssh-key).

If the Droplet is in a **Cloud Firewall**, add inbound rules for TCP on port 22 and TCP 20000–60000.
</Tab>

<Tab value="OVHcloud">
Order a VPS or a Public Cloud instance with **Ubuntu 24.04**.

- OVHcloud's Ubuntu images sign you in as the user `ubuntu`, which can use `sudo`. Use `ubuntu` as the username in OpenPanel; the setup signs in as `ubuntu` and works as root through `sudo`.
- A **VPS** comes with a password for that user. Use it.
- A **Public Cloud instance** is created with an SSH key only. Set a password for `ubuntu` as in [Servers created with an SSH key](#servers-created-with-an-ssh-key).

If you turned on a network firewall for the server's IP address, allow TCP on port 22 and TCP 20000–60000.
</Tab>

<Tab value="Scaleway">
Create an Instance with the **Ubuntu 24.04** image. Scaleway signs you in as `root` with the SSH keys of your project, so the server has no password. Set one as in [Servers created with an SSH key](#servers-created-with-an-ssh-key).

If the Instance's **security group** drops inbound traffic, add rules that accept TCP on port 22 and TCP 20000–60000.
</Tab>
</Tabs>

<Callout type="warn" title="A password from an email">
If the provider emailed you a password, sign in with it yourself once before you connect the server. Some providers make you choose a new password at the first sign-in, and OpenPanel's setup cannot answer that prompt.
</Callout>

## Servers created with an SSH key [#servers-created-with-an-ssh-key]

The connect form takes a password, not a key. A server created with only an SSH key has no usable password, and its SSH usually refuses passwords. Give it both, then connect it.

<Steps>
<Step>
### Sign in with your key [#sign-in-with-your-key]

```bash title="On your computer"
ssh root@203.0.113.10
```

Use your server's address, and `ubuntu` instead of `root` on OVHcloud.
</Step>

<Step>
### Set a password [#set-a-password]

```bash title="On the server"
sudo passwd root
```

For a user that is not root, name that user instead, for example `sudo passwd ubuntu`.
</Step>

<Step>
### Let SSH accept the password [#let-ssh-accept-the-password]

```bash title="On the server"
printf '%s\n' 'PasswordAuthentication yes' 'PermitRootLogin yes' | sudo tee /etc/ssh/sshd_config.d/10-password-for-openpanel.conf
sudo sshd -t && sudo systemctl restart ssh
```

Leave out the `PermitRootLogin yes` line if you sign in as a user other than root.

SSH uses the first value it reads for each setting, in file-name order. The name `10-…` comes before `50-cloud-init.conf`, which turns passwords off on key-only cloud images, and after OpenPanel's own `00-openpanel.conf`. Once the setup has run, OpenPanel's file wins and SSH takes only OpenPanel's key again.
</Step>

<Step>
### Check that the password works [#check-that-the-password-works]

```bash title="On your computer"
ssh -o PubkeyAuthentication=no root@203.0.113.10
```

SSH should ask for the password and let you in. If it does, sign out and connect the server.
</Step>
</Steps>

## 2. Connect it [#2-connect-it]

In [**Servers**](https://openpanel.sh/servers), choose **Add server** → **Connect over SSH**, and enter the server's public IP address, SSH port `22`, the username and the password. Then confirm. The full flow is in [Connect your own server](/docs/servers#connect-the-server).

## After the setup [#after-the-setup]

- SSH moves to a new port and accepts only OpenPanel's key. Your own SSH key and the password stop working over SSH.
- The provider's web console still works: sign in there as `root` with the **Console access** password from the server's page.
- Your provider's firewall can be narrowed to the one SSH port shown on the server's **Overview**. The port 22 rule is no longer needed: the server's own firewall closes port 22 after the setup.

See [What OpenPanel changes on your server](/docs/servers/what-changes).