Enabling and using Cockpit

Pinterest LinkedIn Tumblr +

Cockpit is an amazing way to administrate your CentOS server from a web browser. Of course, the standard disclaimers apply here: make sure you secure things because this is opening your server to the world if it is an internet-facing server. Use VLANs, ACLs, firewall rules, and any other measures available to you to secure access! This is a basic overview of the feature.

Enabling Cockpit

When you login via SSH to a CentOS server, you’ll see the command to enable Cockpit:

systemctl enable –now cockpit.socket

Alright, you type this. Now what?

Open up a web browser and go to https://[serverip]:9090

You’ll have to accept the self-signed SSL. Once you do that, you’ll see the following:

You can now log in. If you have sudo privileges, tick the box “Reuse my password for privileged tasks” otherwise you won’t be able to do much (don’t use root! Seriously – this is Linux 101 right here).

Using Cockpit

Cockpit is incredibly easy to use. It’s like having a control panel for your CentOS system. I’ll highlight some of the features of it.

System

This tab is the first you’ll see after logging in. This will show you what your system is doing as well as some basic options.

Let’s look at software updates because this is an important thing. Always keep your systems patched!

You can see here, we have some patches that need to be installed.

If you want to keep your system updated automatically, you can set the slider to “Automatic updates”. This will prompt you to install the package dnf-automatic.

I prefer to use Ansible to automate this so we don’t need to do this (this will be a future post!) so click the button to Install All Updates (or, login to the terminal and issue a dnf update command).

Some other options from the System tab allow us to change our system hostname as well as give a pretty hostname. We can also join an Active Directory Domain.

Logs

Let me be the first to tell you: sh!t hits the fan and breaks. Having quick access to your system logs is important. This tab will give you access to those functions. Now be patient with this page because your system may have a lot of logs to process. You can filter the logs based on what you’re trying to find such as by level and/or service.

Storage

How much disk space do you have? This tab will give you a quick overview.

File systems in Linux work a lot differently than they do under Windows. For example, you can see that by default, I have 3 partitions: /home, / (root), and /boot. If you have other partitions, you’d see them here.

Networking

This tab will tell you everything that you need to know about your networking setup and also allow you to manually modify your firewall (firewalld better be running!) and you’ll also see your networking logs.

There’s a lot of things to know about networking and I promise I’ll cover them. Right now, make sure you understand the basics. Like you can see what my VM’s IP address is, the bandwidth being sent and received as well as the interface name.

Accounts

Adding a new account to your server is easier than ever with Cockpit! When you select accounts, you can easily create a new system account or modify an existing system account. Let’s take a look at my account:

You can see that I can easily add or remove the server administrator (sudo) role as well as lock account, set a new password, or force a password change. I can also add an authorized public key (another future topic).

Services

This page allows us to manage the services on the server. For example, lets look at the sshd (OpenSSH server daemon) service:

From here, we can stop or restart the service. We can also change the automatic startup of the service to something else (but with SSH, we shouldn’t because this is our remote administration – I’ll cover hardening this in another article).

Other Cockpit Options

Cockpit will give you a lot of control over your system. One of the handy options it’ll provide you is giving you a terminal interface to your server. This is handy in case you’re in a location where you can’t SSH but you can access Cockpit or if SSH is severely restricted. Cockpit is a great remote administration tool. Just remember to keep it secure and you’ll be golden!

Share.

About Author

I am a Cloud Engineer currently working in the healthcare industry.

Leave A Reply