# Connect your own server

Source: https://openpanel.sh/docs/servers

Connect a server you already have with one command, from any provider or from behind your home router, or let OpenPanel set up and harden a fresh Ubuntu server over SSH.

You can connect any server you already have: a cloud server, a dedicated machine, or a computer at home or in an office. There are two ways:

| | **One command** | **Connect over SSH** |
|---|---|---|
| **What you do** | Run one command on the server | Give OpenPanel the server's address and a password, once |
| **Behind a home router or CGNAT** | Works, with nothing forwarded | Needs a public address and TCP ports 20000 to 60000 open to the internet |
| **What it installs** | The [OpenPanel agent](/docs/servers/agent) and Docker | Everything below, and it [hardens the server](/docs/servers/what-changes) and joins it to your [private network](/docs/network) |
| **The server** | Any 64-bit Linux with systemd | A fresh Ubuntu Server 22.04 or 24.04 LTS |

Start with **One command**. Choose SSH when you want OpenPanel to harden a fresh server for you.

Every server you connect is a seat in the Servers plan. See [Plans and prices](/docs/billing). Only the organization's Owner or an Admin can add a server; see [Roles](/docs/members/roles).

## One command [#one-command]

The OpenPanel agent only connects out, to `gateway.openpanel.sh` on port 443. Nothing connects in to the server, so it works behind a home router or a provider's CGNAT with no port forwarded, and you never hand over a password.

### What the server needs [#what-the-server-needs]

- **64-bit Linux with systemd**, on an x86 (`amd64`) or ARM (`arm64`) processor. Ubuntu Server 22.04 or 24.04 LTS is what OpenPanel is tested on.
- **Root**, or a user that can run `sudo`.
- **Outgoing HTTPS** to `openpanel.sh`, `cdn.openpanel.sh` and `gateway.openpanel.sh`. No incoming port.
- `curl` or `wget`, `sha256sum` and OpenSSL 3 or later, to check the agent's signature. Ubuntu has all of them.

The installer adds Docker from the system's own packages if it is missing (on a system with `apt-get`; elsewhere, install Docker first), and `git` and Docker Buildx for builds from Git.

<Steps>
<Step>
### Name the server [#name-the-server]

In the console, open [**Servers**](https://openpanel.sh/servers), choose **Add server** and stay on the **One command** tab, the first and the default. Enter a **Name**, up to 60 characters, for example `home-1`, and choose **Create install command**.
</Step>

<Step>
### Run the command on the server [#run-the-command-on-the-server]

The dialog shows two steps. Under **Run this on the server**, copy the command and run it on the server:

```sh
curl -fsSL https://openpanel.sh/install.sh | sudo sh
```

The installer checks the agent's signature before it installs anything. See [Signed releases](/docs/servers/agent#signed-releases).
</Step>

<Step>
### Paste the token [#paste-the-token]

Under **Paste this token when the installer asks for it**, copy the one-time token and paste it when the installer asks. The typing is hidden, so the token stays out of your shell history and the list of running processes.

The token works once and expires; the dialog says until when. **Make a new token** replaces it, and the earlier one stops working. To pass the token from a script instead, see [With one command](/docs/servers/agent#with-one-command).
</Step>

<Step>
### Wait for it to connect [#wait-for-it-to-connect]

The dialog says **Waiting for the server to connect…** and changes by itself when the installer finishes, usually within a minute. Then it says **Connected.**, with the address the server connected from and the agent's version. Choose **Open** and the server's name, for example **Open home-1**, to see its page.

You can close the dialog before that. The server is listed as waiting until its agent connects, and its page shows the install command again.
</Step>
</Steps>

### What it does not do [#what-it-does-not-do]

One command installs the agent and leaves the rest of the server as it is. It does not change SSH, the firewall, users or passwords, and it does not join the server to your organization's [private network](/docs/network). Keep the server's own security up to date yourself, or connect a fresh Ubuntu server over SSH and let OpenPanel do it.

The agent touches only the containers, networks and volumes it made itself. A server connected this way shows **Overview**, **Running here**, **Agent** and **Disconnect** on its page. See [The OpenPanel agent](/docs/servers/agent).

## Connect over SSH [#connect-over-ssh]

OpenPanel signs in once over SSH with a password, then sets the server up, hardens it, joins it to your private network and installs the agent. It works on a server that the internet can reach, and it needs **TCP ports 20000 to 60000 open to the internet**: the setup moves SSH to one random port in that range and must reach it there.

### What the server needs [#what-the-server-needs-1]

- **A fresh install of Ubuntu Server 22.04 or 24.04 LTS** that nobody has used yet. The setup changes the server completely. See [Requirements](/docs/servers/requirements).
- **A public IP address or host name** that reaches the server, and its SSH port open to the internet.
- **TCP ports 20000 to 60000 open to the internet**, in your provider's firewall or forwarded by your router. If they are blocked, the setup puts the old SSH settings back and stops.
- **A username and password** for root, or for a user that can run `sudo`. The form takes a password, not a key. A cloud server created with only an SSH key needs a password first: see [Connect a cloud server](/docs/servers/cloud-server).

<Steps>
<Step>
### Open the form [#open-the-form]

In [**Servers**](https://openpanel.sh/servers), choose **Add server** and open the **Connect over SSH** tab. It reminds you that TCP 20000 to 60000 must be open, and offers One command instead.
</Step>

<Step>
### Enter the server's details [#enter-the-servers-details]

| Field | What to enter |
|---|---|
| **Name** | How the server appears in OpenPanel, up to 60 characters, for example `web-1`. It also becomes the server's name in the private network. |
| **Public IP address or host name** | The address OpenPanel signs in to. A host name is kept as you type it and resolved again at every sign-in, so a dynamic-DNS name works. |
| **SSH port** | The port SSH listens on now, usually `22`. |
| **Username** | `root`, or a user that can run `sudo`. |
| **Password** | That user's password. It is used once to sign in and is not stored. |

Choose **Continue**.
</Step>

<Step>
### Confirm [#confirm]

OpenPanel lists everything the setup will change: a new user, SSH on a new port with keys only, new passwords, the firewall, updates, Docker and the private network. Read it, tick **I understand. This server is fresh and may be changed.**, and choose **Connect and set up**.
</Step>
</Steps>

### What happens next [#what-happens-next]

The console opens the server's page and shows the [setup steps](/docs/servers/setup-steps) as they run. The console says the setup "takes a few minutes, most of them installing updates". You can leave the page; the setup goes on.

In order, the setup:

1. signs in with your password and checks the system;
2. creates the user `openpanel` with a key only OpenPanel holds;
3. installs updates, automatic security updates, a firewall and fail2ban;
4. moves SSH to a random port and allows only OpenPanel's key;
5. turns on the firewall;
6. installs Docker;
7. joins the organization's [private network](/docs/network);
8. installs the [OpenPanel agent](/docs/servers/agent), which connects out to OpenPanel;
9. keeps the system log across restarts;
10. replaces the passwords of root, `openpanel` and the user you signed in with.

[What OpenPanel changes on your server](/docs/servers/what-changes) lists every change in detail.

When the last step is done, the server shows **Ready**. Its page then shows what it is, how it is doing and how it is protected. See [Server status and journal](/docs/servers/status).

If a step fails, the setup stops there and the page says why. See [The setup steps](/docs/servers/setup-steps) and [A server does not connect](/docs/troubleshooting/server-does-not-connect).

<Callout type="info" title="Limits on connecting">
An organization can try at most five SSH connections in ten minutes. A server already connected to the organization at the same address cannot be added twice.
</Callout>

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

- **The agent runs your services.** It connects out to OpenPanel and keeps that connection open; see [The OpenPanel agent](/docs/servers/agent).
- **SSH takes only OpenPanel's key.** Your password no longer works over SSH.
- **A console password** is set for root and `openpanel`. Use it in your provider's web console, or at the machine's own screen and keyboard. The Owner or an Admin sees it under **Console access** on the server's page.
- **To get the server back**, disconnect it. OpenPanel turns password sign-in back on and shows you the access. See [Disconnect and force disconnect](/docs/servers/disconnect).

<Cards>
<Card href="/docs/servers/home-server" title="Connect a home or office server" description="One command behind your router, with nothing forwarded, or SSH with port forwards." />

<Card href="/docs/servers/cloud-server" title="Connect a cloud server" description="Hetzner, DigitalOcean, OVHcloud and Scaleway, including servers made with an SSH key." />

<Card href="/docs/servers/agent" title="The OpenPanel agent" description="What runs on the server, why it only connects out, and its signed releases." />

<Card href="/docs/servers/what-changes" title="What OpenPanel changes" description="Every change the SSH setup makes, from the user to the firewall." />

<Card href="/docs/buy-a-server" title="Buy a server from us" description="Order a Hetzner server through OpenPanel (a dry run until ordering opens)." />
</Cards>