Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Set Up Cockpit on a Linux Server – Manage Your Server via Web Interface

Discover how to efficiently manage Linux servers with the Cockpit web interface – perfect for beginners and pros

27 November 202610 min read93 Views0 helpful

Introduction

Cockpit is a free web interface for managing a Linux server in your browser. At a glance, you can see CPU, RAM, and storage usage, start and stop services, read logs, install package updates, manage users, and open a terminal when needed—all without needing a separate SSH client. Cockpit is installed directly on the server and uses the existing system users: you sign in with the same username and password you use for SSH.

In this guide, you'll install Cockpit using the package manager on Debian or Ubuntu, secure access with a firewall or SSH tunnel, set up HTTPS with your own certificate or through a reverse proxy, and keep Cockpit up to date. You'll then learn what you can do with Cockpit day to day and where its limitations are.

Info: Don't confuse it with the “Cockpit” One-Click App

The One-Click App named Cockpit in the app catalog is a different program: Cockpit, a headless CMS for managing website content. The Cockpit server management tool described in this guide runs directly on your server's operating system and isn't available as a One-Click App. You install it from the console as described below.

When Cockpit makes sense on a VPS

Cockpit doesn't replace the console, but it can take care of many routine tasks. It's a good fit if:

  • You prefer monitoring your server with a mouse rather than commands, for example, checking usage, available storage, or whether a service is still running.
  • You want to search logs quickly, for example, after your game server crashes or a login fails, filtered by service, time period, and priority.
  • You want to handle updates and restarts conveniently, including seeing whether an update requires a restart.
  • You need access while on the go or from another computer that doesn't have an SSH client installed. The browser terminal is enough for quick tasks.
  • You're still learning Linux: Cockpit first shows many settings graphically, and you can look up the corresponding commands later.

Cockpit is less suitable as a replacement for a hosting panel: it doesn't create websites, email accounts, or databases. It doesn't show Docker containers; its additional container module only works with Podman. And if you already manage your server exclusively through SSH and scripts, you don't need an additional web service that's accessible from the internet.

Manual installation

Cockpit doesn't run in a container; it's installed directly on the server as a package. The following steps are for Debian and Ubuntu. For Fedora, RHEL, Arch Linux, and other distributions, you'll find the commands on the project website.

Requirements

  • A Linux server running Debian (version 10 or later) or Ubuntu, with SSH access. If you're not sure how to do this, see our guide First SSH Login.
  • A user account with sudo privileges that isn't named root. The “First launch and login” section explains how to create one.
  • For HTTPS with a valid certificate: a domain or subdomain whose A record points to your server's IP address (e.g., cockpit.example.com).

Cockpit requires very little resources and works on any VPS. The web service only starts when someone connects to port 9090 (socket activation by systemd). The project doesn't specify a minimum requirement.

Prepare the firewall

Cockpit listens on port 9090 on all network interfaces. Since you'll sign in with a system user that has administrator privileges, you shouldn't open the port to the entire internet. This example uses the UFW firewall. For more about firewalls on Linux, see our guide Manage the Firewall.

Code
sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw allow from 203.0.113.10 to any port 9090 proto tcp
sudo ufw enable
sudo ufw status

Replace 203.0.113.10 with the public IP address of your own connection. If you don't have a static IP address, leave out the line for port 9090 and use the SSH tunnel from the “First launch and login” section or a reverse proxy with HTTPS instead.

Warning: Don't forget the SSH rule

Make sure the SSH rule exists before enabling UFW. Without it, you won't be able to log in to the server over SSH after a connection drops.

Install Cockpit

The Cockpit project recommends installing Cockpit from backports. They contain a much newer version than the standard package sources. The commands work in Bash, which runs by default on your server.

Debian: First enable backports, then install Cockpit:

Code
. /etc/os-release
echo "deb http://deb.debian.org/debian ${VERSION_CODENAME}-backports main" | sudo tee /etc/apt/sources.list.d/backports.list
sudo apt update
sudo apt install -t ${VERSION_CODENAME}-backports cockpit

Ubuntu: Backports are usually already enabled:

Code
. /etc/os-release
sudo apt update
sudo apt install -t ${VERSION_CODENAME}-backports cockpit

The first line reads your version's codename (e.g., trixie or noble) into the VERSION_CODENAME variable, so the commands work on every version. In addition to Cockpit itself, apt installs the recommended modules for storage (cockpit-storaged), networking (cockpit-networkmanager), and software updates (cockpit-packagekit), along with the services those modules require.

The Cockpit socket is enabled automatically during installation. Check whether it's running:

Code
systemctl status cockpit.socket

The output should show active (listening). If it doesn't, start it with sudo systemctl enable --now cockpit.socket.

First launch and login

Cockpit doesn't have its own accounts. You sign in with a user on your server and that user's password. The root user is blocked: during installation, the Debian package (which the Ubuntu package is based on) adds root to the /etc/cockpit/disallowed-users file, and Cockpit's login rejects every user in that file. So signing in as root fails, even with the correct password.

Instead, create a dedicated user and grant it administrator privileges through the sudo group. Replace USERNAME with a name of your choice:

Code
sudo adduser USERNAME
sudo usermod -aG sudo USERNAME
Warning: Don't unblock root

You could remove root from /etc/cockpit/disallowed-users, but this isn't recommended: attackers already know the username and target for root. A dedicated user with sudo can manage everything in Cockpit just as well.

If you've allowed your IP address to access port 9090, open Cockpit in your browser:

Code
https://SERVER_IP:9090

Cockpit creates a self-signed certificate during installation. The first time you open it, your browser will show a security warning, which you can accept for this visit. The next section explains how to set up a valid certificate.

Without opening a port, use an SSH tunnel: If you haven't allowed access to port 9090, forward it to your own computer through your SSH connection. Run this command on your computer (Windows Terminal, macOS, or Linux) and leave the window open:

Code
ssh -L 9090:localhost:9090 USERNAME@SERVER_IP

Then open http://localhost:9090 in your browser. Cockpit allows connections from localhost without HTTPS, and traffic is encrypted through the SSH tunnel.

After logging in, you'll land on the Overview page. In the top-right corner, Cockpit shows whether your session has Limited access or Administrative access. To make system changes (services, updates, users), enable administrative access there and confirm with your password. This only works if your user is in the sudo group.

Access via HTTPS

For ongoing access, you'll need a certificate your browser trusts. There are two ways to set one up.

Option 1: Use your own certificate directly in Cockpit. Cockpit loads certificates from /etc/cockpit/ws-certs.d/ and uses the alphabetically last file with the .cert or .crt extension. The private key must be in a file with the same name and the .key extension, and it must not be encrypted. For example, if you've created a certificate for cockpit.example.com with Certbot (see Set Up Certbot), copy it like this:

Code
sudo cp /etc/letsencrypt/live/cockpit.example.com/fullchain.pem /etc/cockpit/ws-certs.d/50-letsencrypt.cert
sudo cp /etc/letsencrypt/live/cockpit.example.com/privkey.pem /etc/cockpit/ws-certs.d/50-letsencrypt.key
sudo /usr/lib/cockpit/cockpit-certificate-ensure --check
sudo systemctl restart cockpit

The command with --check shows which certificate Cockpit is using. Cockpit reads the files as root, so they can have strict permissions. Let's Encrypt certificates expire after 90 days, so you'll need to repeat the copy after each renewal, for example, with a Certbot deploy hook. You can then access Cockpit at https://cockpit.example.com:9090.

Option 2: Use an nginx reverse proxy. Cockpit runs internally, and nginx makes it available at a standard HTTPS address without a port. First, create the /etc/cockpit/cockpit.conf file (it doesn't exist by default) and add your domain:

Code
[WebService]
Origins = https://cockpit.example.com wss://cockpit.example.com
ProtocolHeader = X-Forwarded-Proto

Origins allows Cockpit to accept requests and WebSocket connections from your domain. Without this line, the page won't load after login because Cockpit rejects requests from untrusted origins. ProtocolHeader tells Cockpit to check the X-Forwarded-Proto header to determine whether the connection to the proxy is encrypted.

To make Cockpit inaccessible from outside, restrict the socket to localhost. Create the /etc/systemd/system/cockpit.socket.d/listen.conf file:

Code
[Socket]
ListenStream=
ListenStream=127.0.0.1:9090
FreeBind=yes

The first, empty line is intentional: it removes the default port 9090 on all interfaces. Apply the changes with:

Code
sudo systemctl daemon-reload
sudo systemctl restart cockpit.socket
sudo systemctl restart cockpit

Install nginx and Certbot:

Code
sudo apt install -y nginx certbot python3-certbot-nginx

Then add a server block for your domain, for example, in /etc/nginx/sites-available/cockpit.example.com:

Code
server {
    listen 80;
    server_name cockpit.example.com;

    location / {
        proxy_pass https://127.0.0.1:9090;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        gzip off;
    }
}

The Upgrade and Connection lines are needed for the WebSockets Cockpit uses to transmit its content. gzip off ensures that Cockpit's ETag header reaches the browser. Enable the site, allow HTTP and HTTPS through the firewall, and use Certbot to get the certificate:

Code
sudo ln -s /etc/nginx/sites-available/cockpit.example.com /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo ufw allow "Nginx Full"
sudo certbot --nginx -d cockpit.example.com

You can then access Cockpit at https://cockpit.example.com. For a general introduction, see our guides Set Up a Reverse Proxy and Create an SSL Certificate.

Tip: Add extra login protection

Anyone who knows the address can see Cockpit's login page. Use a long, unique password for your user, and restrict access to your IP addresses through the firewall or nginx wherever possible. Find more tips in Linux Security Tips.

Back up the configuration

Cockpit doesn't store any of its own user data. Everything you change in Cockpit is applied directly to the system (services, users, packages). You only need to back up your custom Cockpit settings:

Code
sudo tar czf cockpit-config-$(date +%F).tar.gz /etc/cockpit /etc/systemd/system/cockpit.socket.d

The archive contains cockpit.conf, your certificates and private key, the list of blocked users, and the port setting. Store it securely. You'll still need to back up your server's data separately.

Update Cockpit

Cockpit is a regular package on your system. Get new versions with the same command you used to install it, so dependencies also come from backports:

Code
. /etc/os-release
sudo apt update
sudo apt install -t ${VERSION_CODENAME}-backports cockpit

Update additional modules the same way by adding their package names at the end. Alternatively, install updates in Cockpit itself under Updates. Cockpit restarts after an update, so you'll need to reload any open session.

Manage your server with Cockpit

After logging in, the navigation on the left takes you through the main sections. The pages you see depend on which modules are installed.

Overview and usage

The Overview shows the system name, operating system, and current CPU, memory, and disk usage. Select View metrics and history to see when your server was especially busy. You can also set the hostname and system time or restart the server here.

Services and logs

Under Services, you'll find all the systemd services on your server and their status. Select a service to see its latest log entries. You can start, stop, or restart it there, and choose whether it starts at boot. This corresponds to the systemctl start, stop, restart, and enable commands.

Under Logs, you can read the system-wide systemd journal, filtered by time period, priority (for example, errors only), and service. This is the graphical equivalent of journalctl.

Updates and users

Updates lists available package updates, installs them, and tells you if a restart is recommended afterward. Under Accounts, you can create additional system users, set passwords, lock accounts, and add SSH keys.

Terminal

The Terminal opens a shell in your browser. It has exactly the same permissions as your logged-in user, just as if you'd signed in over SSH. Use sudo as usual for administrator commands.

Additional modules

You can extend Cockpit with additional packages, which you install with apt just like Cockpit itself. For example:

PackagePurpose
cockpit-podmanManage containers with Podman (not Docker containers)
cockpit-filesBrowse, upload, and edit files on the server
cockpit-sosreportCreate a diagnostic report for support

Check whether a module is available for your version with apt-cache policy PAKETNAME. For example, on Debian 13, cockpit-files is only available through backports, so install it with sudo apt install -t ${VERSION_CODENAME}-backports cockpit-files.

Cockpit limitations

  • Networking: The Networking page works with NetworkManager. Cockpit doesn't show interfaces that aren't managed by NetworkManager, or shows them with limited functionality. Don't change your VPS network configuration through Cockpit: an incorrect setting could disconnect your server from the network.
  • Firewall: The Firewall page only appears if firewalld is installed. You can't edit UFW rules in Cockpit; use the console instead.
  • Docker: Cockpit doesn't show Docker containers or One-Click Apps. The cockpit-podman module only manages Podman containers.
  • Not a hosting panel: You can't set up websites, email accounts, databases, or game servers with Cockpit. Cockpit manages the operating system, not the applications running on it.
  • Multiple servers: Cockpit can connect to other servers over SSH. The code from all connected servers runs in the same browser context, so only connect to servers you trust.

Conclusion

You've installed Cockpit on your Linux server using the package manager, secured access with a firewall or SSH tunnel, set up HTTPS, and learned how to manage services, logs, updates, and users in your browser. Keep Cockpit up to date with apt.

If you're looking for an application you can install in a few clicks without using the console, check out the One-Click Apps available for your VPS.

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

Neither is the right choice for the Cockpit server management tool: Cockpit manages the operating system itself, so it's installed directly on the server using the package manager (apt), as described in this guide. The Cockpit project only recommends running it in a container for container-focused systems such as Fedora CoreOS. The “Cockpit” One-Click App in the app catalog is a different program: Cockpit, a headless CMS for managing website content.
On Debian and Ubuntu, the Cockpit package adds the root user to /etc/cockpit/disallowed-users during installation. Cockpit rejects every user in that file, even if the password is correct. Create a dedicated user, add it to the sudo group with sudo usermod -aG sudo USERNAME, and enable administrative access in the top-right corner after signing in.
Use an SSH tunnel: run ssh -L 9090:localhost:9090 USERNAME@SERVER_IP on your computer, keep the connection open, and go to http://localhost:9090 in your browser. Alternatively, make Cockpit available under your own domain with HTTPS through a reverse proxy such as nginx, and restrict Cockpit itself to 127.0.0.1.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.