Remote Access VM on VirtualBox from Google Chrome


I need to run a Windows desktop application to keep track of my expanse. Because CodeWeavers needs Android and Asus ChromeBox CN60 doesn’t have Android support yet according to the list, the only solution is remote access.

My experiment with QNAP Virtualization Station is good but it loses keyboard input sometimes. I have to refresh the page to get it back again. Therefore, I give phpVirtualBox a shot.

Eventually, I realize the lack of RDP-compatible client on ChromeOS makes it impossible to access VirtualBox from CN60.

Table of Contents

Install VirtualBox and Related Packages

Install VirtualBox and Extension Pack
Install Apache, PHP, and UFW
Install phpVirtualBox

Manage phpVirtualBox

Change Password
Manage Users
Enable Remote Display

Connect to VirtualBox

Linux: GNOME Remote Desktop Viewer
Mac: CoRD
Android: Remoter RDP Client
Android: Microsoft Remote Desktop

Tips

Find Who is Running vboxwebsrv
Check IP Address for the Host
Disable phpvirtualbox Authentication
Check the OS Detail
Manage a .deb Package
VNC and Windows RDP Solutions

Reference

Install VirtualBox and Related Packages

First, to access VM remotely, it needs to be launched by VirtualBox on Ubuntu first.

Next, I need the Oracle VM VirtualBox Extension Pack on communication. It implements the VirtualBox Remote Display Protocol (VRDP) based on the VirtualBox Remote Desktop Extension (VRDE) interface. There are also other third-party solutions. With this package, the display can be sent to the remote client while the mouse and keyboard signal from the remote client can be sent back to the VM. Chapter 7. Remote Virtual Machines explains in detail on the topic.

Last, to manage from a web browser, phpVirtualBox simplifies the job.

Install VirtualBox and Extension Pack

Download both from here. They need to be the same version number. For example, if VirtualBox 6.0.4 is installed, get the VirtualBox 6.0.4 Oracle VM VirtualBox Extension Pack.

The one in “Ubuntu Software” is an older version on 2019/4/11. It doesn’t work on Ubuntu 18.10. I install both and get into troubles. Finally, I use dpkg to remove the older version and reinstall the official, it works. Also, there is no extension pack in “Ubuntu Software”. Use the latest version on the official web site is the best source.

In Ubuntu, the vboxwebsrv won’t be launched automatically after installation because it uses systemd service file. Here is why and the solution is here.

Because this is just a quick test, I launch manually binding localhost 127.0.0.1:

$sudo vboxwebsrv -H 127.0.0.1

Back to Table of Contents.

Install Apache, PHP, and UFW

To launch phpVirtualBox, Apache and PHP must run first. Uncomplicated Firewall (UFW) is suggested to manage firewall rules easier. More usage detail is here. Run these commands to install necessary packages, run Apache with PHP support, and allow Apache to pass through the firewall:

$sudo apt-get update
$sudo apt-get install apache2
$sudo apt-get install php libapache2-mod-php php-soap php-xml
$sudo apache2 -k restart
$sudo apt-get install ufw
$sudo ufw enable
$sudo ufw allow "Apache"

To check what has been added to the firewall rules:

$sudo ufw status

Create a “/var/www/index.php” as below. Load “http://localhost/index.php” to see if Apache and PHP work properly.

<?php phpinfo(); ?>

Back to Table of Contents.

Install phpVirtualBox

Download from the master branch on GitHub and unzip. If the master branch doesn’t support current VirtualBox, try the developer branch. Unzip and rename the downloaded file into the folder “phpvirtualbox”. Copy to “/var/www” where $USER is the user name used to login to Ubuntu:

$sudo cp -r /home/$USER/Downloads/phpvirtualbox /var/www/html

Next, prepare the basic configuration. Create one from copying the example file:

$sudo cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/virtualbox/config.php

For better security, it’s a good idea to create a new user account in Ubuntu to launch vboxwebsrv. Provide the user name and password running vboxwebsrv in “config.php” to replace ‘vbox’ and ‘pass’ as below. It’s detail explained in Cannot login to vboxwebsrv #89 by 3PO commented on Jan 26, 2018.

var $username = 'vbox';
var $password = 'pass';

Please also read this because the vboxwebsrv won’t be launched automatically in Ubuntu due to systemd.

For a quick test, ignore the security settings and launch manually binding localhost 127.0.0.1:

$sudo vboxwebsrv -H 127.0.0.1

A more detailed explanation is here.

Back to Table of Contents.

Manage phpVirtualBox

If Apache, PHP, and phpVirtualBox are installed and the vboxwebsrv is launched, a login dialog appears loading “http://localhost/phpvirtualbox&#8221;. The default user name and password for phpVirtualBox are both “admin”.

It’s a good habit to change the default password immediately.

After importing VM and enable remote display, the server side is ready for test.

Change Password

The default user name and password for phpVirtualBox are both “admin”. Change the login user’s password from [File] → [Change Password].

Back to Table of Contents.

Manage Users

To manage users, open the “Preferences” dialog by [File] → [Preferences]. Switch to [Users] section to create, remove, promote to administers, and change password.

Back to Table of Contents.

Enable Remote Display

Open the “Settings” dialog of the VM which needs to be connected remotely. Switch to [Display] section. In the [Remote Display] tab, tick the [Enable Server] and assign the port number for this VM in [Server Port].

Last, allow this port number to pass through the firewall. If the port number is 3390, run this command to allow:

$sudo ufw allow 3390

For higher security specifying both allow port and IP address range from 192.168.1.0 to 192.168.1.255, use IP Calculator to get the netmask 24 and run this command instead:

$sudo ufw allow from 192.168.1.0/24 to any port 3390

Ubuntu Documentation explains UFW in detail. Here are my firewall rules. :

$sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Apache                     ALLOW       Anywhere                  
3390                       ALLOW       192.168.1.0/24          
Apache (v6)                ALLOW       Anywhere (v6)

Back to Table of Contents.

Connect to VirtualBox

The built-in console in phpVirtualBox needs the Adobe Flash Player. Since Google decides to remove Flash completely by the end of 2012, I look for other solutions.

Because VRDP is backward-compatible to Microsoft’s Remote Desktop Protocol (RDP), any RDP client should be able to remote control the VM. Here is a list of my test results.

If more than one client needs to connect to the same VM at the same time, tick the [Allow Multiple Connections] in the [Remote Display] tab. Both clients have control of the VM at the same time.

Strangely, phpVirtualBox has problems saving settings in [Authentication Method] and [Allow Multiple Connections]. Sometimes it works. VirtualBox desktop application doesn’t have this issue.

Linux: GNOME Remote Desktop Viewer

It’s default installed in Ubuntu 18.10. Select [Protocol] “RDP” and assign [Host] as [IP Adress]:[Port Number] of the VM.

For example, if the IP address of VirtualBox is 192.168.1.50 and the VM is assigned with 3390 as the [Server Port] for remote display, the [Host] is “192.168.1.50:3390”.

Use the [Bookmarks] menu to manage hosts.

If the VM is already connected by others and doesn’t allow for multiple connections, GNOME Remote Desktop crashes immediately.

Back to Table of Contents.

Mac: CoRD

Like GNOME Remote Desktop Viewer, it works perfectly. But CoRD is unstable, I have several crashes during testing.

Use the [Servers] button to manage hosts.

Back to Table of Contents.

Android: Remoter RDP Client

Although Remoter runs on Android, there are no missing features. It uses [Address] as the [Host] in GNOME Remote Desktop Viewer. The format is the same.

To launch the keyboard within the remote client, touch the screen with three fingers or use the red circle on the upper right corner to select the [Windows Keyboard]. The Android keyboard has no use to control remote server.

Use the [+NEW CONNECTION] button to create hosts and long press on a connection to edit or delete.

Back to Table of Contents.

Android: Microsoft Remote Desktop

Microsoft Remote Desktop doesn’t work.

It displays “… the PC can’t be found…” using the port 3389 connecting to the VM. The error code is 0x104.

The warning message “Identity of remote PC cannot be verified” using other ports. There seems to be a protocol error. The error code is 0xd06.

Eventually, I give it up.

Back to Table of Contents.

Tips

Find Who is Running vboxwebsrv

To verify if the user running vboxwebsrv is the same to config.php, run to identify:

$ps aux | grep vboxwebsrv

Back to Table of Contents.

Check IP Address for the Host

My favorite ifconfig is not a built-in command in Ubuntu 18.10. It needs to install net-tools to use. Therefore, I use hostname instead:

$hostname -I

Back to Table of Contents.

Disable phpVirtualBox Authentication

Uncomment the following line in config.php to disable authentication when login to phpVirtualBox:

#var $noAuth = true;

Back to Table of Contents.

Check the OS Detail

The Ubuntu version and code name are detailed in “/etc/os-release”. Useful when VirtualBox won’t start after an update. Sometimes the kernel has changed, and VirtualBox needs an update, too.

$cat /etc/os-release

Back to Table of Contents.

Manage a .deb Package

dpkg is the tool to manage packages. Here is a list of frequently used parameters:

  • -i + package file name: install a package file
  • -r + package name: remove a package
  • -P + package name: remove a package and its configuration files
  • -l | less: list all installed packages by page

dpkg-reconfigure is to reconfigure and repair an installed package. Therefore, it needs the package name.

Here are some examples:

$sudo dpkg -i virtualbox-6.0_6.0.4-128413~Ubuntu~bionic_amd64.deb
#sudo dpkg-reconfigure virtualbox-6.0

Back to Table of Contents.

VNC and Windows RDP Solutions

Another remote solution needs to use VNC technology. Both noVNC and RDP Wrapper may help.

For noVNC, websockify needs to be launched on the server side. Use a modern browser to access. There is no need to install any client software because the server uses HTML5 technology.

For RDP Wrapper, it supports Windows only. After installation, use any compatible RDP client to access.

Back to Table of Contents.

Reference

  1. AskUbuntu: How can I get vboxweb to start properly at boot
  2. AskUbuntu: How do I find my internal ip address?
  3. AskUbuntu: How do I install a .deb file via the command line?
  4. Asus ChromeBox
  5. Ciiag: Poor Mans Virtualized Server
  6. CodeWeavers: How to install CrossOver Chrome OS
  7. Digital Ocean: How To Install the Apache Web Server on Ubuntu 18.04
  8. GitHub: noVNC
  9. GitHub: phpvirtualbox
  10. GitHub: phpvirtualbox: Issues: Cannot login to vboxwebsrv #89
  11. GitHub: phpvirtualbox: Wiki: Common phpVirtualBox Errors and Issues
  12. GitHub: phpvirtualbox: Wiki: Getting started
  13. GitHub: phpvirtualbox: Wiki: vboxweb service Configuration in Linux
  14. GitHub: phpvirtualbox: Wiki: Web server and PHP installation
  15. GitHub: RDP Wrapper
  16. Google Play: Microsoft Remote Desktop
  17. Google Play: Remoter RDP Client
  18. IP Calculator
  19. Linuxize: How to Install PHP on Ubuntu 18.04
  20. Migrate Windows Virtual Machine from VirtualBox to QEMU/QNAP Virtualization Station
  21. nixCraft: How to check os version in Linux command line
  22. SourceForge: CoRD
  23. SourceForge: Wiki: phpVirtualBox: Home
  24. SourceForge: Wiki: phpVirtualBox: vboxweb-service Configuration in Linux
  25. Step to Install: Step to install .deb file using command line terminal in Ubuntu
  26. The Chromium Projects: Chrome OS Systems Supporting Android Apps
  27. TurnKey Linux: Forums: Turnkey PHPVirtualBox Tutorial
  28. Ubuntu Documentation: UFW
  29. Ubuntu Wiki: Releases
  30. VirtualBox: User Manual: Chapter 7. Remote Virtual Machines
  31. VirtualBox: Download VirtualBox
  32. Website for Students: Manage Headless VirtualBox Host On Ubuntu 16.04 LTS With PhpVirtualBox, Apache2 And PHP 7.1

One thought on “Remote Access VM on VirtualBox from Google Chrome

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.