Cockpit is a Linux tool that allows you to perform system administration tasks via a graphical user interface (GUI), namely, a web browser. Traditionally, Linux administration was done using the command line, and a good sysadmin was characterized by the number of commands he knew well. Cockpit as a GUI tool aims to lower the barrier of entry for new sysadmins on Linux while making it easier for everyone with a friendly, clickable interface. In this article, I'll take a look at Cockpit, its features, advantages, limitations, and disadvantages.
Latest posts by Edem Afenyo (see all)

Advantages and key features

The ability to manage your Linux system with the click of a mouse has many advantages. Cockpit is designed with features to maximize those advantages for sysadmins of all skill levels. Some of the more prominent features and advantages of Cockpit are:

Easier administration

For new admins and those who do not know the underlying commands, Cockpit allows you to perform common sysadmin tasks from the browser. It has an intuitive interface that can help go through the day without having to drop to the command line, even with little prior experience. You can also use it alongside the command line as you build your skills. Cockpit uses the same APIs as the command line applications, so you can be sure you are getting firsthand feedback in your interactions with the system.

While you are in Cockpit, you get access to embedded dashboards for various subsystems. This gives you an overview of the health of the system without having to enter a suite of commands. Most of the key subsystems are just tabs away, so you can navigate with ease.

Cockpit also allows you to perform remote system administration. You can check on multiple systems and manage virtual machines and containers from the same console. This is arguably much easier for the administrator than using the traditional command line–only approach. The more systems you have to administer regularly, the easier it gets by having everything in one place.

Viewing Cockpits system dashboard

Viewing Cockpits system dashboard

Extensibility

Another key feature of Cockpit is that it is extendable. Though it comes with a built-in growing list of features, such as package management and network monitoring and configuration, you can always install a plugin to add more functionality. For example, you can add virtual machine management or container management functions by installing extra packages.

Cockpit is an actively maintained open-source project with an equally active community. The community contributes many third-party plugins that enrich Cockpit even further. You can also write a plugin if you think there is a useful feature that is missing from the ecosystem.

Installing a plugin

Installing a plugin

Efficient resource usage

Cockpit uses a Linux socket for communication. This means that it does not need to have resource-consuming daemons in the background when it is not in use. When you need it, Cockpit runs on demand.

Familiar management interface for different platforms

Another advantage of having a GUI administration tool like Cockpit is that, instead of worrying about the nuances of the various Linux distributions, especially for new admins, you get a familiar interface everywhere Cockpit is used. This takes away some of the cognitive load as the underlying tools are abstracted away under the Cockpit UI.

Security

With Cockpit, you maintain the privileges of the user who logs in for the whole session. You can elevate your privileges for certain tasks, as you would on the command line, but you cannot do anything you couldn't do outside the browser window.

Elevating user privileges

Elevating user privileges

This makes it easy for a senior admin to, for example, delegate the management of an application server to a developer without having to worry about unauthorized access to system resources.

Embedded terminal

Finally, to one of my favorite features. Cockpit comes with an embedded terminal. Not satisfied with what you can do with the GUI, or want to perform a more nuanced command? Drop to the terminal in your browser, and execute the commands you want. You can also elevate your privileges with sudo in the terminal.

Using the embedded terminal

Using the embedded terminal

Cockpit usage scenarios

System monitoring

Cockpit provides real-time monitoring of system resources, such as CPU usage, memory usage, and disk usage. This makes it easy to identify resource-intensive processes or applications and to take corrective action as needed.

Monitoring system performance

Monitoring system performance

User management

Cockpit allows administrators to manage user accounts, create new users, and configure user permissions. This makes it easy to control access to sensitive files and applications.

Managing user accounts

Managing user accounts

Service management

Cockpit provides a centralized interface for managing system services, such as Apache, MySQL, and SSH. This makes it easy to start, stop, and restart services, as well as configure service settings.

Managing services

Managing services

Software updates

Cockpit allows administrators to install, update, and remove software packages on Linux servers. This makes it easy to keep systems up-to-date with the latest security patches and feature updates.

Managing available software updates

Managing available software updates

I experienced an issue with listing available updates on Ubuntu while writing this post. Cockpit would get stuck loading the list of available updates because the required files were being used by the unattended-upgrades service to automatically install updates.

Cockpit stuck loading updates

Cockpit stuck loading updates

To work around this, you can disable the unattended-upgrades service as shown below and manage updates directly with Cockpit or Ansible. This is a step normally taken in production, where unattended updating is usually undesirable.

Disabling unattended upgrades

Disabling unattended upgrades

Also, after fully updating my system, I could not log in to Cockpit on the new version of Firefox (version 112).

Error running Cockpit on Firefox 112

Error running Cockpit on Firefox 112

You can switch to Chrome or downgrade Firefox to restore access. This issue was fixed in Cockpit 275 but the standard repositories for Ubuntu at this time have version 264. You can also use backports to get the latest version of Cockpit, version 287, with the fix.

Network management

Cockpit provides a simple interface for configuring network settings, including IP addresses, DNS settings, and network interfaces. This makes it easy to manage network connectivity and troubleshoot network issues.

Managing network interfaces

Managing network interfaces

System logs

Cockpit allows administrators to view and manage system logs, making it easy to identify and troubleshoot system issues.

Viewing system logs

Viewing system logs

Limitations and disadvantages

Limited flexibility

GUI administration tools are often limited in their ability to customize or automate tasks. This can be a disadvantage for experienced users, who prefer to customize their workflow and automate repetitive tasks.

Extra packages to install and manage.

From a security standpoint, the more packages you have installed on your system, the wider your attack surface. Having Cockpit and its plugins translates to a longer list of installed packages. This can be a dealbreaker for highly sensitive environments, such as banks. Also, for a sysadmin, the extra packages are just another list of things to think about—maintenance, troubleshooting, updating, etc.

Lack of control over features

Following the open-source model has many advantages. However, if you do not want to go into development or jump through hoops to get a particular version, you are stuck with what is available to your distribution. If you want a feature, say, a dark mode switch, you have to wait until it is important enough for the maintainers and the community to get it in your systems. Sometimes, the features you rely on may be deprecated. Newer releases may not make it to your distribution's official repositories until much later.

Deployment overhead

If you manage a fleet of servers that do not come with Cockpit enabled, you need to perform the initial task of installing and enabling Cockpit on all servers to enable remote management. This overhead is necessary and begins to take a toll as the number of servers increases. Thankfully, with configuration management tools like Ansible, you can reduce the time it takes to get all your servers Cockpit-ready.

Limited support options

Cockpit does not give you native enterprise support options with response and resolution time guarantees. You have GitHub issues that are handled according to the maintainers' priorities. This can be a problem for some environments. Cockpit's frequent release cadence helps address this limitation by ensuring that new versions with potential fixes appear every two weeks.

How to install Cockpit

Now that you know all about Cockpit, how do you get it installed so you can begin to take advantage of its goodness?

For many modern Red Hat–flavored distributions, Cockpit comes preinstalled. You do still have to install plugins separately for extra features. You may also have to enable Cockpit through systemd to begin to use it.

If Cockpit doesn't come preinstalled in your distribution, you will have to follow the docs. However, you can install Cockpit on Ubuntu as follows:

First, execute apt install cockpit as a superuser (sudo) in a terminal emulator, as in the snippet below. Tack on the -y switch to install all necessary packages automatically, too.

sudo apt install cockpit -y

You should see output in your terminal akin to the screenshot below.

Installing Cockpit

Installing Cockpit

Enable the cockpit socket as a superuser and turn it on immediately (now), as shown below. Enabling the socket allows it to survive reboots.

sudo systemctl enable --now cockpit.socket

There will be no response to the last command but navigate to http://localhost:9090 to confirm Cockpit is up and running.

You should meet a screen similar to this:

Viewing the login screen

Viewing the login screen

Alternatives to Cockpit for Linux GUI administration

In the GUI system administration space, Webmin is a very popular alternative to Cockpit. It is also web-based, with many modules for managing various Linux components. It even allows you to manage services, such as databases, email, and webservers, from its console. It does always have to run in the background, which is one of the ways in which it differs from Cockpit. Ajenti is another open-source web-based alternative to Cockpit.

With the advent of terminal user interfaces (TUIs), some administration tasks have become easier on the command line. TUI allows users to interact with software applications through a command line interface (CLI). Unlike a traditional GUI, which typically includes windows, icons, menus, and buttons, a TUI presents information and options in a text-based format within a terminal window. However, you still miss out on having everything in one place and on having context-enriching metrics automatically pulled in as you get with Cockpit.

Finally, most distributions have a settings app that allows you to manage many subsystems via the GUI. The problem with them is that they are mostly not designed to support remote administration. You also need to have the GUI subsystem installed before you can use some of these apps. The look and feel of the local apps may differ per distribution, giving a sysadmin a bit more work if there are many different systems.

Subscribe to 4sysops newsletter!

Conclusion

Cockpit eases system administration for admins of all experience levels, plays well with other sysadmin tools, and allows you to use the most convenient methods to keep your servers working at their best. With Cockpit, you get an extensive list of features and secure access to many operating system components with minimal performance overhead. On the flip side, you also have to manage a longer list of installed applications and ensure that there are systems in place to take advantage of frequent releases while providing feature stability to your environment.

avataravatar
3 Comments
  1. PowerMe! (Rank 3) 4 days ago

    When I was using Fedora server, I explored cockpit. I was trying to remember why I did not pursue! As you have said, Webmin is nice alternative. One of the reasons I liked webmin was it also allows one to set up multi-factor authentication (MFA). Any advice on how one can set up MFA on cockpit access?

    • PowerMe! (Rank 3) 4 days ago

      Ah figured out. It seems like you can use google authenticator installed on the OS by appending :

      auth required pam_google_authenticator.so nullok

      to. /etc/pam.d/cockpit

      On Webmin one can set up MFA from the UI.

  2. PowerMe! (Rank 3) 4 days ago

    also, I realized on some systems with ufw firewall as in mine, needed to allow tcp 9090

Leave a reply

Your email address will not be published.

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account