I lost the password for my OpenVZ container(actually I was using private key ssh but lost the file, so after setup I never logged in with root password) but I still have root access on the host machine, I'm not running HyperVM anymore, When I was it was just a matter of su vm1 or whatever vm user, and it would drop me into the containers root shell. How do I get there from pure OpenVZ? Or just reset the root password like I used to be able to do with HyperVM. This OpenVZ is not managed by any other OpenVZ gui based manager either.


Are your openvz running? If so, try:

vzctl enter $vz_ID

wher $vz_ID is the container ID (output of vzlist). This will give you root access and you will then be able to change your password.

Anyway, with root access on the host, you can always edit the passwd and shadow files located at /vz/private/$vz_ID/etc/passwd and /vz/private $vz_ID/etc/shadow to change passwords.

  • I usually change the root password of a running CT in one step from the HN: vzctl CTID exec passwd – Bruno9779 May 12 '14 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.