Previous page

Next page

Locate page in Contents

Print this page

Logging In

We've demonstrated the login procedure in the beginning of this chapter when we created a sample program. This subsection describes the procedure in detail.

The initial login is performed by executing the system/login request:

<packet version="4.0.0" id="3">

  <data>

    <system>

      <login>

        <name>cm9vdA==</name>

        <realm>00000000-0000-0000-0000-000000000000</realm>

        <password>bXlwYXNz</password>

      </login>

    </system>

  </data>

</packet>

In this example, we are logging in as the root user (the name and the password values are base-64 encoded according to the XML Schema). We are specifying the ID of the System Realm that we retrieved earlier because root is the user of the host server (the Hardware Node). As a result, Agent will try to find the user in the host operating system user registry and will verify that the supplied credentials are correct. If we wanted to log in as a user from any other Realm, we would execute the same call supplying the appropriate user name, password, and the Realm ID.

When logging in as a user from the Virtuozzo Container Realm (another built-in Realm), the call is executed slightly differently. Let's say that we want to log in to Agent as the root user from one of the Containers running on the Hardware Node. This is how you do it:

<packet version="" id="3">

  <data>

    <system>

      <login>

        <name>cm9vdA==</name>

        <domain>ZTlhYjI4MzQtZWQ5Ny0xZjRiLWJkNDEtODFjMjdmYWNmYzMw</domain>

        <realm>00000000-0000-0000-0100-000000000000</realm>

        <password>bXlwYXNz</password>

      </login>

    </system>

  </data>

</packet>

Compared to the previous login example, the XML packet above contains an additional domain parameter. When logging in as a user from the Virtuozzo Container Realm, the domain element must contain the Server ID of the Container. See Retrieving a List of Virtuozzo Containers section for an example on how to retrieve Server IDs.

If the login is successful, the output will contain the user security information and will look similar to the following:

<packet id="3" priority="0" version="4.0.0">

  <origin>system</origin>

  <target>vzclient19-4fce28dd-0cd3-1345-bb94-3192b940fb90</target>

  <data>

    <system>

      <token>

        <user>AQUAAAAAIAHdKM5P0wxFE7uUMZK5QPuQAAAAAA==</user>

        <groups>

          <sid>AQUAAAAAIADdKM5P0wxFE7uUMZK5QPuQAAAAAA==</sid>

          <sid>AQUAAAAAIADdKM5P0wxFE7uUMZK5QPuQAQAAAA==</sid>

          <sid>AQUAAAAAIADdKM5P0wxFE7uUMZK5QPuQCgAAAA==</sid>

          <sid>AQUAAAAAIADdKM5P0wxFE7uUMZK5QPuQAgAAAA==</sid>

          <sid>AQUAAAAAIADdKM5P0wxFE7uUMZK5QPuQAwAAAA==</sid>

          <sid>AQUAAAAAIADdKM5P0wxFE7uUMZK5QPuQBAAAAA==</sid>

          <sid>AQUAAAAAIADdKM5P0wxFE7uUMZK5QPuQBgAAAA==</sid>

          <sid>AQUAAAAAIAHdKM5P0wxFE7uUMZK5QPuQAAAAAA==</sid>

        </groups>

        <deny_only_sids/>

        <privileges/>

      </token>

    </system>

  </data>

</packet>

The output contains the security IDs (SIDs) of the user and all the groups to which the user belongs as a member.

Please send us your feedback on this help page