Sharing Ubuntu “host” printer with Windows XP running in VirtualBox

Have you ever wanted to print from Windows XP running within a VirualBox to a printer connected to your Ubuntu “host”? I have. This is how I managed to do it. I am assuming that you already have your printer configured and that you can print for Ubuntu and that you have configured your VirtualBox Windows XP with networking.

Enable access to your printer from any host

First, you need to enable CUPS so that it will accept connections from your VirtualBox Windows XP. To do this do:

  1. Select the System menu -> Administration -> Printing. The Printer configuration window will appear.
  2. Select the Settings menu item from the Server menu.
  3. Make sure that there is a tick mark next to “Publish shared printers connected to this system”

    Enabling Printer connections from any host

    Enabling Printer connections from any host

  4. Press OK

Identify the Printer URL

We now need to identify the URL of the printer so that we can use this in  VirualBox Windows XP.

  1. In your web browser, navigate to http://localhost:631/ to access the Common UNIX Printing System (CUPS) administration pages
  2. Press the “Manage Printers” button. This will display a list of your configured printers
  3. Click on the name of your printer. This will display a page about your printer.
  4. Copy the URL of the page from the address bar of your browser. For my printer it is http://localhost:631/printers/PhotosmartC5100 but will be different for your printer.

Test Accessing the printer from VirtualBox Windows XP

We now need to check we can access the CUPS web pages from the VirtualBox Windows XP.

  1. Start your web browser and open the url http://<ubuntu_host&gt;:631/ where <ubuntu_host> is the IP address of your Ubuntu machine
  2. The web page that loads will be the Common UNIX Printing System (CUPS) administration pages
  3. Press the “Manage Printers” button. This will display a list of your configured printers
  4. Click on the name of your printer. This will display a page about your printer.
  5. Copy the URL of the page from the address bar of your browser. For my printer it is http://<ubuntu_host&gt;:631/printers/PhotosmartC5100 but will be different for your printer. We will need this later when configuring the printer on Windows

Setting up the Windows printer

We now need to configure the printer in Windows XP.

  1. Open the Control panel and select Printers
  2. Press Add Printer. The Add Printer wizard will appear. Press Next
  3. Select “A network printer, or a printer attached to another computer” and press next
  4. Select “Connect to a printer on the Internet or on a home or office network” and enter the printer URL from step 5 above in the URL box and [press Next
  5. In the Add Printer Wizard window, either select your printer and press Next or press “Have Disk” and follow the instructions to install your printer.
  6. Wait for the printer to be installed and configured. This may take a moment or two.
  7. You will then be asked if you want to make this printer your default printer. Select Yes or No and press Next.
  8. Press the Finish button.

Testing the Windows printer

You should now be pack in the Printers section of the Control panel and your newly added printer will be listed. Lets test that the printer worked.

  1. Right click on the printer and select properties
  2. Press the “Print Test Page” button.
  3. Your printer should print a test page.

These are the steps that worked for me. I hope they work for you so that you can print from Windows running in VirtualBox.

5 Responses to “Sharing Ubuntu “host” printer with Windows XP running in VirtualBox”

  1. Grateful Says:

    Thankyou, worked easily, I spent hours trying to achieve this, before I discovered this page and I hadn’t checked the server box.
    Your time and effort is much appreciated

  2. Richard J. Donovan Says:

    Thanks. You are a gentleman and a scholar.

    Network printing always had worked all right, though was strange to set up on the Windows XP side. USB support was very hit-or-miss. About halfway through the explanation I experienced the “aha” moment. Now I need not bother with getting USB support, or even Windows XP network printing (in its own right), working in VirtualBox and Windows XP. Just reach through to CUPS!

  3. Very nice! « Tom's Ranting Says:

    […] https://funwithlinux.wordpress.com/2009/05/22/sharing-ubuntu-host-printer-with-windows-xp-running-in-… […]

  4. dave Says:

    Thank you so much for a very straightforward explanation. This is wonderful.

    I’ve worked on this for most of the day (Kubuntu running XP in VBox) and was exhausted with forum searches. Everything was a total dead-end, and I was about to give it up when I found your page.

    Every part of your instructions worked flawlessly the first time. It was easy to see where it was leading as well. I was a linux admin years ago (95), and had been away from it for a long time. It’s been great getting back into it – especially with helpful pages like yours (I’m bookmarking).

    As with the others, this is much appreciated and thanks again for your truly public service !

  5. Uri Says:

    thank you so much! you trully helped me finally solve this issue!

Leave a reply to dave Cancel reply