# Server command

URL: https://docs.vaultpanel.net/cli/server-command

> The vaultpanel command on the panel's own server, for its address, status, logs, restarts, updates, rollbacks, backups, HTTPS and the setup token.

The installer adds a `vaultpanel` command to the panel's server (`/usr/local/bin/vaultpanel`). Its **server commands** look after the panel on that server. Every other command is handed to the [CLI](https://docs.vaultpanel.net/cli), which works through the panel's API with an API token.

```bash
vaultpanel                       # address, status and version
sudo vaultpanel update           # a server command
vaultpanel servers list          # handed to the CLI
```

Commands marked **root** need `sudo`. Most others read `/opt/vaultpanel/.env`, which only root and the panel can read, so they also show more with `sudo`.

## Overview

| Command | Root | What it does |
| --- | --- | --- |
| `vaultpanel` | | Address, status and version, and the setup token while no owner exists. |
| `vaultpanel status` | | The panel, worker, agent, database and Redis. |
| `vaultpanel logs [panel\|worker\|agent] [-f]` | | Recent log lines; `-f` keeps following. |
| `vaultpanel start`, `stop`, `restart` | root | Control the panel and worker. |
| `vaultpanel update [--version <vX.Y.Z>] [--force]` | root | Back up, then install the newest package or the one given. |
| `vaultpanel rollback [--yes]` | root | Go back to the version before the last update, with its database. |
| `vaultpanel backup [--dir <folder>] [--keep <n>] [--label <name>]` | root | Back up the panel's database, settings and certificate now. |
| `vaultpanel restore <file> [--yes]` | root | Put a backup back, on this server or a new one. |
| `vaultpanel https [status\|on\|off\|renew]` | `on`, `off`, `renew` | The panel's own HTTPS certificate. |
| `vaultpanel url [<address>]` | root | Show or change the panel's address. |
| `vaultpanel setup-token` | root | The token for creating the owner account. |
| `vaultpanel version` | | The installed version. |
| `vaultpanel help` | | The server commands, then the CLI's command groups. |

Some commands answer to a second name: `info` (same as `vaultpanel` alone), `log` (`logs`), `upgrade` (`update`), `tls` (`https`) and `address` (`url`).

## `vaultpanel`

```text
 __     __          _ _   ____                  _
 \ \   / /_ _ _   _| | |_|  _ \ __ _ _ __   ___| |
  \ \ / / _` | | | | | __| |_) / _` | '_ \ / _ \ |
   \ V / (_| | |_| | | |_|  __/ (_| | | | |  __/ |
    \_/ \__,_|\__,_|_|\__|_|   \__,_|_| |_|\___|_|
  Address:   https://203.0.113.10:8090
  Panel:     running    Worker: running    Agent: running
  Version:   0.3.0 (agent 0.41.0)
```

While no owner account exists, it also prints the `/setup` address, and as root the setup token.

## `status`

```bash
vaultpanel status
```

The state of the `vaultpanel`, `vaultpanel-worker` and `vaultpanel-agent` services, and whether the panel reaches its database and Redis (from the panel's `/api/v1/health`). As root, it also lists the panel's Docker containers.

## `logs`

```bash
vaultpanel logs              # the panel (web interface and API)
vaultpanel logs worker -f    # the worker, following new lines
vaultpanel logs agent        # this server's agent
```

Shows the last 100 lines from the service's journal. `panel` (or `api`), `worker` and `agent` choose the service; `-f` or `--follow` keeps following. In a terminal, the panel's and worker's JSON log lines are printed readably.

## `start`, `stop` and `restart`

```bash
sudo vaultpanel restart
```

`restart` restarts the panel and worker, `stop` stops them, and `start` starts the panel's database and Redis containers, then the panel and worker. Restart after changing `/opt/vaultpanel/.env`.

## `update`

```bash
sudo vaultpanel update                   # the newest version
sudo vaultpanel update --version v0.3.0  # a given version
```

| Option | What it does |
| --- | --- |
| `--version <vX.Y.Z>` | Install this version from VaultPanel's package repository. |
| `--force` | Set the same version up again when there is nothing newer. |
| `--branch <name>` | Only for a panel installed from a copy of the repository: follow a branch. |

It backs the panel up first (label `pre-update`) and refuses versions older than the installed one. See [Updating](https://docs.vaultpanel.net/getting-started/updating).

## `rollback`

```bash
sudo vaultpanel rollback
```

Restores the database from the backup taken just before the last update, then installs the version from before it. It asks you to type `rollback`; `--yes` (`-y`) skips the question. Changes made in the panel since the update are lost.

## `backup`

```bash
sudo vaultpanel backup [--dir <folder>] [--keep <n>] [--label <name>] [--quiet]
```

| Option | What it does |
| --- | --- |
| `--dir <folder>` | Where to write it. Default: `VAULTPANEL_BACKUP_DIR`, `/var/backups/vaultpanel-panel`. |
| `--keep <n>` | Keep only the newest `n` backups with this label. |
| `--label <name>` | The label in the file name (`a-z`, `0-9`, `-`, at most 32 characters). Default: `manual`. |
| `--quiet` | Print only the backup file's path. |

See [Backing up the panel](https://docs.vaultpanel.net/getting-started/backing-up-the-panel) for what a backup holds and the settings that encrypt it or copy it off the server.

## `restore`

```bash
sudo vaultpanel restore /var/backups/vaultpanel-panel/vaultpanel-20261020-031500-scheduled.tar.gz
```

Checks the backup against its checksum, takes a safety backup, then puts back the database, settings, secret key, certificate and the panel's files, updates the database and restarts. It asks you to type `restore`; `--yes` (`-y`) skips the question.

## `https`

```bash
vaultpanel https              # status
sudo vaultpanel https renew
```

| Action | What it does |
| --- | --- |
| `status` (the default) | Whether HTTPS is on, the certificate's names, expiry, SHA-256 fingerprint and agent pin. |
| `on` | Turn HTTPS on for a panel installed with plain HTTP. Prints the command to run on each other server. |
| `renew` | A new certificate with this server's current names and addresses, made with the same key so the agents' pin does not change. Prints the command to run on each other server. |
| `off` | Back to plain HTTP. Not recommended. |

See [Panel HTTPS and domain](https://docs.vaultpanel.net/getting-started/panel-https-and-domain).

## `url`

```bash
sudo vaultpanel url                            # show the address
sudo vaultpanel url https://panel.example.com  # change it
```

The address must look like `https://panel.example.com` or `https://203.0.113.10:8090`, without a path. Changing it restarts the panel.

- With an `https://` address, sign-in cookies become HTTPS-only and agents must use HTTPS. With `http://`, both are relaxed again.
- When HTTPS is on, an `http://` address on the panel's own port is refused: that port serves HTTPS.
- When the certificate does not name the new address's host, the command tells you to run `sudo vaultpanel https renew`.

## `setup-token`

```bash
sudo vaultpanel setup-token
```

Prints the setup token while no owner account exists. Once the owner exists, the token no longer works and the command says so.

## `version` and `help`

```bash
vaultpanel version   # VaultPanel 0.3.0 (agent 0.41.0)
vaultpanel help
```

On the panel's server, `--version`, `-v`, `--help` and `-h` also go to these server commands, not to the CLI. For the CLI's help, use `vaultpanel <command> --help`.

## The login banner

When someone logs in to the server over SSH, a banner shows the VaultPanel logo, links to the website and this documentation, the panel's address with whether it is running, and the `vaultpanel` command. The agent hides the system's own welcome text, news and update notices by default (agent 0.21.0 or newer). To show the system's message again, open the server's **Security** tab in the panel and click **Show the system’s message** on the **Login message** card; **Show only VaultPanel** switches back.
