Connect to a remote virtual machine with rdesktop
VirtualBox is an incredibly useful tool. You can run different OSes for testing purposes, you can set up servers on machine that wouldn't normal act as servers, the sky seems to be the limit. And VirtualBox is an easy tool to use.
One of the really cool aspects of VirtualBox is that it can also work as a virtual machine server. With that you can run an instance of a virtual machine from a remote location. Of course you have to have the piece of software to connect to VirtualBox. On Linux one very handy tool for that is rdesktop. In this article I am going to show you how to connect to a VirtualBox machine using rdesktop.
So far I have covered VirtualDesk fairly extensively so far. The VirtualBox "cannon" includes:
- Installing and configuraing VirtualBox for virtual OSes.
- Installing Windows XP as a virtual machine in VirtualBox.
- Install Guest Additions for a better VirtualBox experience.
- A new way of thinking, thanks for virtual machines.
- Install VirtualBox Guest Additions in Windows 7.
- Install VirtualBox with USB support.
Before you read this particular article, you might want to go through the above series so you have a better understanding of VirtualBox.
Configuring your virtual machine
Before you even try to connect to a virtual machine (with any software) you first have to set up your virtual machine so that it will allow connections to be made. VirtualBox uses the VRDP protocol for remote connections. What you need to do is go into the settings of the virtual machine and enable this. NOTE: You have to do this on a VM by VM basis. Just because you enable VRDP on one virtual machine does not mean it will be enabled on all VMs.
Let's work with a Windows 7 virtual machine. Windows 7 (or Vista) is a special instance because you have to actually enable remote connections within the operating system as well as within VirtualBox. With Windows XP or most instances of Linux, you will not have to do anything beyond enabling VRDP in VirtualBox.
To enable VRDP open up VirtualBox and click on the virtual machine you want to connect to. Now click the Settings button. NOTE: If the settings button is grayed out you need to start that virtual machine and then power it off. If you just save the state of the virtual machine you can not change the settings.
Once inside the settings window click on the Remote Desktop "tab" (see Figure 1).
In this section you will need to click the checkbox for "Enable VRDP Server". Once that is checked you can configure the options to suit your needs (the defaults work fine for Windows 7) and then click OK when you are finished.
Now it's time to boot up your Windows 7 virtual machine. When Windows 7 is up and running click on the Start menu and enter "Remote" (no quotes) in the Search area. You will see a few entries in the results. Of those entries clickÂ "Allow remote access to your computer".Â When this new window opens (see Figure 2) you need to check "Allow Remote Assistance connections to this computer" and then check the middle option under the Remote Desktop section.
After you have taken care of this, click OK and you are ready to connect. Time to go over to your remote Linux machine.
Installing and using rdesktop
Installing rdesktop is simple:
- Open up a terminal window (you'll need one open anyway).
- Enter the command sudo apt-get install rdesktop.
- Enter your sudo command.
- What rdesktop install.
After rdesktop is installed, you're ready. To connect to the remote virtual machine you will enter a command like this:
rdesktop -u USER -p PASSWORD -g RESOLUTION -a COLORDEPTH ADDRESS
- USER is the username of the HOST.
- PASSWORD is the password for the user on the HOST.
- RESOLUTION is the resolution you want to use.
- COLORDEPTH is the amount of colors use (16 or 24).
- ADDRESS is the location of the server housing the virtual machine (including the port).
So the command I use to connect is:
rdesktop -u jlwallen -p password -g 1224x1024 -a 16 192.168.1.100:3389
You will know right away if your connection worked because the virtual machine will open in a new window.
And that's all it takes. You can use this virtual machine as if it were on your local machine.
VirtualBox continues to show itself to be one of the most flexible, useful tools available. By employing a simple tool like rdesktop, you can now connect to a centralized virtual machine server with ease.Advertisement