LinuxCommandLibrary

pct-console

Access Proxmox container console

TLDR

Attach to a terminal

$ pct console [100]
copy

Detach from a terminal
$ <Ctrl a><q>
copy

SYNOPSIS

pct console <vmid>

PARAMETERS

<vmid>
    The unique numeric Virtual Machine ID of the target Proxmox LXC container. This argument specifies which container to connect to.

DESCRIPTION

pct console is a command-line utility provided by the Proxmox Container Toolkit (PCT) that allows users to connect directly to the console of a running or stopped Linux Container (LXC) on a Proxmox VE host. It primarily acts as a wrapper for the lxc-attach command, enabling direct interaction with the container's shell environment. This is particularly useful for debugging, performing administrative tasks, or troubleshooting containers, especially when network access (e.g., SSH) to the container is unavailable or misconfigured. The command requires the Virtual Machine ID (vmid) of the target container to establish the connection.

It provides a secure and reliable way to get a shell inside the container, even if its network stack is broken or it's stuck during boot, making it an essential tool for Proxmox administrators.

CAVEATS

Connecting to the container's console via pct console typically requires root privileges on the Proxmox host. The container must be in a state where lxc-attach (the underlying command) can successfully connect; usually, this means the container is running. If the container's init system or shell is unresponsive, the console session might appear to hang. It provides direct console access only, without features like file transfer that are common with SSH.

PURPOSE AND USE CASES

pct console provides a direct, low-level interface to the container's operating system, bypassing network layers. This makes it invaluable for recovering containers with network configuration issues, troubleshooting boot failures, or for initial setup where network services haven't started yet. It connects you directly to the container's PID 1's TTY, or a new TTY if available.

While primarily for emergencies, it's also convenient for quick administrative tasks without needing to configure SSH keys or remember container IPs.

SECURITY CONSIDERATIONS

As pct console grants direct access (often equivalent to root within the container, depending on the container's user mapping) to the container from the host, proper host security and access control are paramount. Any user with sudo access to run pct console on the Proxmox host can effectively gain access to the container. It's crucial to restrict host access to trusted administrators.

HISTORY

pct console is an integral part of the Proxmox Container Toolkit, which was developed alongside Proxmox Virtual Environment (PVE) to provide robust management for Linux Containers (LXC). Its introduction aimed to simplify direct console access to LXC containers, mirroring the qm console functionality for KVM virtual machines, thereby offering a unified management experience within the Proxmox ecosystem. It has been a core utility since the early days of LXC support in Proxmox VE, evolving with the platform to ensure reliable container management.

SEE ALSO

pct(1), lxc-attach(1), lxc-console(1), qm(1), ssh(1)

Copied to clipboard