If you regularly run a couple of OS from your VirtualBox and want to login to those OS directly from GDM session, here is a quick way to do it. For this to work you should have already set up your VirtualBox. Here we won’t be talking about how to setup VirtualBox but only how to login to a virtual OS from GDM session.

Windows XP GDM
Windows XP GDM

1. Create a bash script with the following contents

VirtualBox -startvm NameOfYourVirtualOS

Replace yourSUPassword with your password, and NameOfYourVirtualOS with the name that you have given to your virtual OS in VirtualBox.

2. Name it something like windowsXPGDM (if you want to run Windows XP), make it executable, and then copy it to /usr/bin.

$ chmod 755 windowsXPGDM
$ sudo cp windowsXPGDM /usr/bin

2. Go to /usr/share/xsessions and create a new file with the following contents:

[Desktop Entry]
Comment=My Virtual WindowsXP

3. Save it with a name something like windowsXP.desktop.

4. Log out and you will see a new entry WindowsXP in your GDM session. You can now directly open VirtualBox session without even logging in to your Ubuntu machine.