How to set username and password in VBox websrv

Discussions related to using VirtualBox on Windows hosts.
Post Reply
liupengjian
Posts: 20
Joined: 29. Sep 2008, 03:54

How to set username and password in VBox websrv

Post by liupengjian »

I am writing a programe to connect to VBox server, and I am using VBox's webserver by runing vboxwebsrv.exe.
By setting: VBoxManage setproperty websrvauthlibrary null
can login the web server without username and password.

however, I need some kind of authentication, so I need to set a user name and password. Any one knows how to set that?
(seems need to do with WSDL, but I am not sure how to do)
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

This is all described in the SDK documentation.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
liupengjian
Posts: 20
Joined: 29. Sep 2008, 03:54

Post by liupengjian »

I have read the SDK doc, but still not quite sure what to do exactly.
Can you give some more details?

very urgent. thanks
liupengjian
Posts: 20
Joined: 29. Sep 2008, 03:54

Post by liupengjian »

ok I got it. the user name and password for vbox authentication is same login name and password for the host which the vbox is installed.
so no need to set a user name and password in any files in vbox.
liupengjian
Posts: 20
Joined: 29. Sep 2008, 03:54

Post by liupengjian »

Sorry, still have problem here, it seems any username and password will pass the authentication.

Code: Select all

VBoxManage setproperty websrvauthlibrary default
vboxwebsrv -t 1000
and in VBox API I called:

Code: Select all

vbox = VirtualBox.connect(HostIP, "Admin", "pswd"); //admin, and pswd are my system username and password
but it seems all string can pass the authentication.

I saw in SDK doc:

Code: Select all

#include "VRDPAuth.h"
/**
* Authentication library entry point. Decides whether to allow
* a client connection.
*
* Parameters:
*
* pUuid Pointer to the UUID of the virtual machine
* which the client connected to.
* guestJudgement Result of the guest authentication.
* szUser User name passed in by the client (UTF8).
* szPassword Password passed in by the client (UTF8).
* szDomain Domain passed in by the client (UTF8).
*
* Return code:
*
* VRDPAuthAccessDenied Client access has been denied.
* VRDPAuthAccessGranted Client has the right to use the
* virtual machine.
* VRDPAuthDelegateToGuest Guest operating system must
* authenticate the client and the
* library must be called again with
* the result of the guest
* authentication.
*/
VRDPAuthResult VRDPAUTHCALL VRDPAuth(PVRDPAUTHUUID pUuid,
                                     VRDPAuthGuestJudgement guestJudgement,
                                     const char *szUser,
                                     const char *szPassword
                                     const char *szDomain)
{
   /* process request against your authentication source of choice */
   return VRDPAuthAccessGranted;
}
If I want to set up an user name and password,do I have to change the code above? How do I make sure of this code?

Code: Select all

VBoxManage setproperty websrvauthlibrary default|null|<library>
what is <library>? what should I put here for library?

Thanks , very urgent.
Post Reply