Accessing Cockpit Pages with cockpit-desktop (with examples)
- Linux
- November 5, 2023
Introduction
Cockpit is a web-based graphical interface for Linux systems management. It allows users to monitor and manage their servers through a web browser. One of the ways to access Cockpit is through the cockpit-desktop
command.
In this article, we will explore different use cases of the cockpit-desktop
command and provide code examples for each case. We will also discuss the motivation behind using each example, explain the arguments used, and provide example outputs.
Use Case 1: Open a page
To open a Cockpit page using cockpit-desktop
, use the following command:
cockpit-desktop url SSH_host
Motivation: By using cockpit-desktop
, we can securely access Cockpit pages in an already running session. This is useful when we want to monitor or manage our Linux server remotely through a web browser.
Explanation:
url
: The URL of the Cockpit page you want to open.SSH_host
: The hostname or IP address of the server to connect to via SSH.
Example:
cockpit-desktop url https://example.com:9090
Output:
This will start cockpit-ws
and a web browser in an isolated network space, and a cockpit-bridge
in the current running user session. It will then open the specified Cockpit page in the web browser, providing secure access to the Cockpit interface.
Use Case 2: Open storage page
To open the storage page in Cockpit using cockpit-desktop
, use the following command:
cockpit-desktop /cockpit/@localhost/storage/index.html
Motivation: The storage page in Cockpit allows us to manage disks, partitions, and filesystems on our Linux server. By opening the storage page, we can easily monitor and manage the storage resources on our system.
Explanation:
/cockpit/@localhost/storage/index.html
: The path to the storage page in Cockpit.
Example:
cockpit-desktop /cockpit/@localhost/storage/index.html
Output:
This will start cockpit-ws
and a web browser in an isolated network space, and a cockpit-bridge
in the current running user session. It will then open the storage page in the web browser, providing access to the storage management capabilities of Cockpit.
Conclusion
The cockpit-desktop
command provides a convenient way to access Cockpit pages securely in an already running session. By using this command with different URLs, we can open various Cockpit pages and manage different aspects of our Linux server. Whether it’s monitoring system information or managing storage resources, Cockpit offers a user-friendly web-based interface to simplify server management tasks.