── guests shell ─────────────────────────────────────────────────────────────
()
| 619 | // ── guests shell ───────────────────────────────────────────────────────────── |
| 620 | |
| 621 | func newGuestsShellCmd() *cobra.Command { |
| 622 | return &cobra.Command{ |
| 623 | Use: "shell <vmid>", |
| 624 | Short: "Open an interactive shell inside a guest", |
| 625 | Long: `Open an interactive shell inside a running guest. |
| 626 | |
| 627 | For LXC containers: SSHes to the Proxmox node and runs 'pct enter <vmid>' |
| 628 | (NixOS containers are detected automatically and use 'pct exec' instead). |
| 629 | Requires ssh_user to be configured. |
| 630 | |
| 631 | For QEMU VMs: opens a direct SSH connection to the VM's IP address. |
| 632 | Requires the VM to have an IP address visible to pvetui (e.g. via QEMU guest |
| 633 | agent) and vm_ssh_user (or ssh_user as fallback) to be configured. |
| 634 | |
| 635 | Authentication follows the standard SSH priority: agent > configured keyfile |
| 636 | > ~/.ssh defaults.`, |
| 637 | Example: ` pvetui guests shell 100 |
| 638 | pvetui --profile prod guests shell 200 |
| 639 | pvetui --ssh-user root guests shell 100`, |
| 640 | Args: cobra.ExactArgs(1), |
| 641 | RunE: runGuestsShell, |
| 642 | ValidArgsFunction: completeVMIDs, |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | func runGuestsShell(cmd *cobra.Command, args []string) error { |
| 647 | vmid, err := parseVMID(args[0]) |