Tuesday, March 17, 2015

VirtualBox RDP

Shell Script to setup username and password for RDP connection to VirtualBox VM.

#!/bin/bash
Proj=$1
User=$2
Pass=$3
Hash=`VBoxManage internalcommands passwordhash $Pass | awk {'print $3'}`
VBoxManage setproperty vrdeauthlibrary "VBoxAuthSimple"
VBoxManage modifyvm $Proj --vrdeauthtype external
VBoxManage setextradata $Proj "VBoxAuthSimple/users/$User" $Hash

Run the script with 3 arguments - Project, Username, Password

To Remove an user from RDP login,
VBoxManage setextradata $Proj "VBoxAuthSimple/users/$User"

After setup, to connect via RDP to a VirtualMachine, use the following command:
rdesktop-vrdp remotehost:3388 -u UserName -p PassWord