share printer connected to Ubuntu from Windows XP on VirtualBox
November 5th, 2007
This is as straightforward as setting up a network printer from Windows XP.
First of all you've got to set up a private network connection between the host and the guest operating system.
Then you have to make sure that CUPS is accepting connection from other hosts.
When finished with all this foreplay, you can go ahead and use the printer from Windows XP. Boot your VirtualBox and enter Windows XP. Go to Start → Settings → Printers and Faxes. Click on Add a printer. Tell the wizard that you wish to add a network printer. Specify that you want to Connect to a printer on the Internet or on a home or office network. Specify the URL of your printer. It should be something like:
Where in printer-name you should replace the name of your printer. Complete the installation of your printer by specifying the driver to be used. You should now be able to print from your Windows XP now.
First of all you've got to set up a private network connection between the host and the guest operating system.
Then you have to make sure that CUPS is accepting connection from other hosts.
When finished with all this foreplay, you can go ahead and use the printer from Windows XP. Boot your VirtualBox and enter Windows XP. Go to Start → Settings → Printers and Faxes. Click on Add a printer. Tell the wizard that you wish to add a network printer. Specify that you want to Connect to a printer on the Internet or on a home or office network. Specify the URL of your printer. It should be something like:
http://10.0.1.1:631/printers/printer-nameWhere in printer-name you should replace the name of your printer. Complete the installation of your printer by specifying the driver to be used. You should now be able to print from your Windows XP now.
February 5th, 2008 at 10:59 pm Great post, but I have one bizarre problem. Whenever I print from the virtual machine, a watermark is printed. I have made sure this feature is off both on the VM (XP) and host (ubuntu) but it makes no difference. Any suggestions?
July 1st, 2008 at 1:20 pm Thanks for the post. I got it to work after disabling firestarter and Windows firewall - and finally working out the address of my printer. However, then I rebooted and couldn't connect. So I then edited the /etc/rc.local script as you suggested. But then Virtual box gave me an error to do with permissions and wouldn't start.
So I retraced and did everything again. But this time I lost all connectivity. I couldn't ping the printer, I couldn't access the internet in either Ubuntu or XP.
So in the end I disabled the new adapter in VB. I regained connectivity to the internet.
So this is really a long way of saying is there any advice you can give me to get the printer working again? If there are any commands I would appreciate them.
BTW I have Ubuntu Hardy on AMD64 with latest VirtualBox as host and XP as the guest.
March 16th, 2009 at 10:35 am Your solution worked perfectly for me. I'm now able to printer from Windows XP guest OS to my HP LaserJet 1020 printer connected to my Ubuntu 8.10 host. When I first used http://10.0.1.1:631/printers/HP-LaserJet-1020 I did get an error message which I immediately knew how to resolve since I have experience with setting up network perinters. I knew that 10.0.1.1 was the default gateway for the computer that you used within your example. To resolve the problem, I ran an ipconfig to get the IP address information on the guest computer, and changed your statement to reflect the default gateway of my guest OS which is:
http://10.0.2.2:631/printers/HP-LaserJet-1020
The average person may not know how to resolve this problem. A more accurate/universal way to state your resolution would have been to say
http://default-gateway-ip-address/printers/printer-name
I'm just making a friendly suggestion. I appreciate your solution though, it definitely worked for me. I have no reason to boot into Windows now other than to play games. I'm running VirtualBox 2.0.4 on Ubuntu 8.10 in seemless mode without any problems with playing sound in the guest OS or printer from the guest OS to my printer connected to my computer running Ubuntu 8.10.
July 6th, 2009 at 11:26 pm I got virtualbox printing to the host's printer using these instructions. (The host is Mandriva 2009.1). I didn't have a
Listen localhost:631line in my /etc/cups/cupsd.conf, so I didn't add a
Listen *:631line there, but it still worked.
Thanks for this write-up!!
-Daniel-
July 13th, 2009 at 3:27 am Patrioti kai adelfe,
i have the following situation: host ubuntu 9.04, guest XP. all instructions followed and everything looks ok. however when i click to print, i get a job completed but CUPS but there is no activity on the printer... any suggestions?
euxaristw prokatavolika.
September 14th, 2009 at 7:12 pm What version of VirtualBox are you using? I can select Attached to: Host Interface and select tap0 from a list, but I can not find Host Interface Settings. Then when I go into windows, I can not see tap0 in network connections.
September 28th, 2009 at 11:03 am Setting up the private network works just fine, unfortunatly, i cannot get access to the cups printer share. alle i get is a http 403....
any ideas?
thank you for your post.
June 24th, 2010 at 2:44 pm The howto is form 2007. Is it still that complicated?
July 26th, 2010 at 4:29 am I'm getting a massage in the XP VB, saying that I "do not have access to the printer, please try another username or password."
I can ping either way and I have changed the cupsd.conf.
Can anyone help? Thanks.
July 26th, 2010 at 4:35 am Ah. I spoke too soon. I've found the solution in another article:
Using Ubuntu 8.04 host, from Win2000 in VirtualBox, I got an "access denied" message in Add Printer dialog, until adding this "Allow from" line to cupsd.conf:
# Restrict access to the server...
Order allow,deny
Allow from 10.0.1.*
http://www.giannistsakiris.com/index.php/2007/11/04/cannot-print-from-shared-printer-in-ubuntu/#comment-2049