User Tools

Site Tools


lxc-containers_password_reset

Lost Root Password

Sometimes you may forget the root password, or for some reason were not provided one at the time you created the container.
This is not an issue, you can reset the root password but locating the directory where the container is placed.
Replace <mycontainer> with your container name:

# cd /var/lib/lxc/<mycontainer>
Now we chroot to this container so we can use the binaries associated with it:
# chroot rootfs/
Once we have done this, run the passwd command to reset the root password:
# passwd

Congratulations, you can now log into the container with the root user and password you just set.
Use ctrl + D to exit out of the chroot

lxc-containers_password_reset.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1