2.2.4. Setting Passwords for Virtual Machines and Containers

In OpenVZ, you can use the --userpasswd option of the prlctl set command to create new accounts in your virtual machines and containers directly from the hardware node. The created account can then be used to log in to the virtual machine or container. The easiest way of doing it is to run this command:

# prlctl set MyCT --userpasswd user1:2wsx123qwe

This command creates the user1 account in the container MyCT and sets the 2wsx123qwe password for it. Now you can log in to the container as user1 and administer it in the same way you would administer a standalone server: install additional software, add users, set up services, and so on.

The prlctl set command can also be used to change passwords for existing accounts in your virtual machines and containers. For example, to change the password for user1 in the container MyCT to 0pi65jh9, run this command:

# prlctl set MyCT --userpasswd user1:0pi65jh9

When setting passwords for virtual machines and containers, keep in mind the following:

  • You can manage user accounts only inside virtual machines that have OpenVZ guest tools installed.
  • You should use passwords that meet the minimum length and complexity requirements of the respective operating system. For example, for Windows Server 2008, a password must be more than six characters in length and contain characters from three of the following categories: uppercase characters, lowercase characters, digits, and non-alphabetic characters.
  • You should not create accounts with empty passwords for virtual machines and containers running Linux operating systems.