How to enter the console of a openvz container from the host

openvz

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.

Best Answer

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.

Related Topic