How to print to a Linux host from a MS Win XP Pro guest using  VMware Workstation 6

How to print to a Linux host from a MS Win XP Pro guest using VMware Workstation 6
Yasha Karant 21 May 2008
For a number of releases, VMware Workstation (hence called Workstation) has not supplied any automatic installation and configuration of Samba to allow the guest OS to print to the host printers. The functionality of allowing the guest to get to the file system (directories and files, with directories termed “folders” in the MS Win world) that was supplied by Samba is now provided through shared files provided the guest supports this mechanism.
My particular problem was: how to get a MS Win XP Pro guest to use the CUPS printer on a RHEL5 Linux host?
After experimenting, I now have this working. If you find a simpler method that reliably works, please advise and I will test and revise this document. The methods and conditions here work on my systems.
Assumptions:
1. Users on the host who use the guest want access to the host printer.
2. Use of the host printer for VMware should not allow other machines or users from other machines access to the host printer because of the use with VMware. If the host printer is to be externally (e.g., network) accessible, such use should be configured and allowed by other mechanisms.
Steps:
1. Make certain that host only networking is established on the VMware virtual machine; I use two “ethernet” interfaces. One allows the guest to share the IP address of the host via NAT for regular Internet and network access; the other is a private host­only network. /sbin/ifconfig ­a shows:
vmnet1 Link encap:Ethernet HWaddr 00:50:56:C0:00:01 inet addr:172.16.237.1 Bcast:172.16.237.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
1
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3048 errors:0 dropped:0 overruns:0 frame:0
TX packets:4483 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 R
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
vmnet8 Link encap:Ethernet HWaddr 00:50:56:C0:00:08 inet addr:172.16.139.1 Bcast:172.16.139.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2441 errors:0 dropped:0 overruns:0 frame:0
TX packets:645 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
2. As root, install the full Samba RPMs, including swat . This can be done most easily through Applications ­­ Add/Remove software that will solve RPM (package) dependencies.
3. As root, manually modify /etc/samba/smb.conf . Here is my smb.conf file:
[global]
netbios name = LINUXSIDE
server string = Samba Server Version %v
interfaces = lo, vmnet1, vmnet8, 172.16.237.1, 172.16.139.1, 127.0.0.1
passdb backend = tdbsam
hosts allow = 172.16.237.0/255.255.255.0, 172.16.139.0/255.255.255.0
printing = cups
print command = lpq command = %p
lprm command = # [homes]
# comment = Home Directories
# read only = No
#
# browseable = No
[printers]
2
comment = All Printers
path = /var/spool/samba
read only = No
guest ok = Yes
printable = Yes
browseable = Yes
Note the stanza that mentions the explicit vmnetX (X being some additional character such as a number) and the various ways the IP address or portions thereof, along with the mask (255.255.255.0). These values may change on your system depending upon how VMware configures itself (or you configured it).
4. As root, use smbpasswd ­a YOUR­USER­NAME (where YOUR­USER­NAME is the account name, e.g., jsmith, used to logon to your machine ­­ root is ill advised to use as a general logon because of security issues). Follow the prompts.
5. As root, strings /etc/samba/passdb.tdb | less to verify that the Samba accounts actually are generated. The account names from step 4 should be visible.
6. As root,
/etc/init.d/smb start
if Samba is not running. If smb is running,
/etc/init.d/smb restart
7. As your end­user,
smbtree
that will prompt you
Password: to which you supply the password entered in step 4. You should see a response such as:
WORKGROUP
\\LINUXSIDE Samba Server Version 3.0.25b­1.el5_1.4
\\LINUXSIDE\hplj HP LaserJet 2200D
\\LINUXSIDE\IPC$ IPC Service (Samba Server Version 3.0.25b­1.el5_1.4)
3
8. Activate VMware, and within the virtual machine, activate MS Win XP Pro.
9. In MS Win XP Pro, activate MS Windows Explorer (you do not need to use MS Internet Explorer). In the entry dialog box, delete whatever is present and type \\LINUXSIDE
assuming you use the Samba configuration file I use. You will be asked for a user name and password; use the ones you entered in step 4 and that you used in step 7.
9.1 Eventually, you should see an icon for the Linux printer. Activate it and install it following the MS Windows prompts and dialog boxes. If you are using a Postscript printer as I do, I do not select the actual printer that I have, but rather an Apple Laserwriter, generally not color unless the printer really is a color Postscript printer. I have no experience with using a non­Postscript printer by this mechanism; you probably can use the actual printer model in the MS Windows pull­down menu.
9.2 After you have completed the selection and installation, open the properties of the printer and print a test page. You should get a MS Windows XP Printer Test Page output on your printer. If not, and the printer does work from CUPS under Linux, something else is wrong that I have not yet encountered.
4