Skip to content

Proxmox — Reset LXC Container Root Password

You locked yourself out of an LXC container and don't have the password. As long as you have access to the Proxmox host, this takes under a minute.


Pre-requisites

  • Access to the Proxmox host (via web UI console or SSH)
  • The container must be running
  • The container ID (visible in the Proxmox UI next to the container name)

Steps

1. Log into the Proxmox host via SSH or the web console.

2. Attach to the container (replace 301 with your container ID):

lxc-attach -n 301

You are now inside the container as root — no password required.

3. Reset the password:

passwd

Enter and confirm the new password. Exit the container:

exit

4. Log into the container as usual with the new credentials.


Find the Container ID

In the Proxmox web UI, the container ID is the number shown in parentheses next to the container name in the left sidebar, e.g. mycontainer (301).

Alternatively, list all containers from the Proxmox host shell:

pct list

Common Issues

Symptom Cause Fix
lxc-attach: failed to get init pid Container is stopped Start the container first: pct start 301
passwd: Authentication token manipulation error Filesystem mounted read-only Remount rw: mount -o remount,rw / inside the container