Samba Networking IIA: Printer Sharing HowTo: Windows Print Server on a Linux-Windows Home Workgroup. Simply put: it’s about printing to a Windows computer from a Linux computer.
This HowTo is not specific to any particular Linux Distribution, although the work was done using Suse 10.1
In this tutorial you have a home network (workgroup). Some hosts run Linux and some run Windows. You already use simple Samba sharing to effect file sharing across the workgroup. Now we wish to share a printer on a Windows host as a print server for both Windows and Linux clients. The reverse scenario where we wish to share a printer on a Linux host as a print server for both Linux and Windows clients is covered in Samba Networking IIB. This HowTo assumes you have CUPS printing installed. We will discuss two independent, alternative options, namely LPD protocol and SMB (Samba) protocol.
Fixed IP address or DHCP Addressing? The IP addresses on your hosts are either fixed (hand coded by you) or assigned on startup by a DHCP server. Your print server can have either a fixed or a dynamic (DHCP) IP address. BUT it is importannt if you use a dynamic address that you install adequate Linux NetBIOS Name Resolution. Here is the discussion and here are some recipes.
Setting up the Windows print server.
Share the printer: In this example I have a Canon BJ200 printer shared as CanonBub. To share a printer do this: Start –> Printers & Faxes –> R-click printer icon –> Sharing –> Share this printer –> Type in your choice for share name. I chose CanonBub for this example. Note there are NO SPACES.
Record your NBT server address: You also want the Windows NBT address which you can get from a dos prompt available at Start –> All Programs –> Accessories –> Command Prompt. In the command prompt enter “ipconfig/all”. You’ll see the IP address for the ethernet adapter, 192.168.2.4 and the NBT name DragaXP in this example. You’ll need IP if using fixed addressing or NBT name if using dynamic addressing.
Enable Windows support for Unix printing: Open Control Panel –> Add or remove programs –> Add/remove windows components. Scroll down to “Other Network File & Print Services”. Highlight that and select “details”. Put a check mark in “Print Services for Unix” and OK/Next or whatever.
Now that Unix services are installed, you activate them as a service: Open Control Panel –> Administrative Tools –> Services (Local) and find TCP/IP print server. It should be set to “Status= started” and “Start type=Automatic”. To change settings you double Lclick the line “TCP/IP print server” and adjust appropriately.
OK, now you have a windows workstation sharing a Windows printer to Linux clients. The next segments show HowTo set up the Linux client to print to this Windows print server, using two alternative network protocols.
Setting up a Linux client to print using LPD protocol (alternative to Samba)
Note in this example the client does NOT use or need Samba
The first thing is to set the root uid and password for cups. This is different from the Linux “root user”. Open a terminal as superuser and entering the chosen username/password as follows: lppasswd -a username. You then supply a password which must satisfy certain criteria, as you might discover. Finally start cups by entering: /etc/init.d/cups start[FYI some of the options for daemons are start, stop & restart]. Here’s the terminal session:
ethel@linux:~> su Password: linux:/home/ethel # lppasswd -a ethel Enter password: Enter password again: linux:/home/ethel # /etc/init.d/cups start Starting cupsd done linux:/home/ethel #
That was the session for early cups admin gui’s, pre Cups V1.2 & pre Suse V10.2; In Suse 10.2 some users have trouble with this and must work as root. The command line dialogue as root is/starts:
linux:/home/ethel # lppasswd -g sys -a root
Now you ensure that it starts at boot: In Suse do Yast –> system –> system services –> expert mode –> cups –> checkmark runlevels 2, 3 & 5.
Now that you can access cups administration you set up communications with the priner that is on the Windows server. Open Cups Admin’s GUI via its HTTP:// address in Konqueror or your browser [sometimes Ffox plays up so you might prefer Konq]: http://localhost:631/ and select “printers” from the screen that opens. After security formalities you are presented with a review screen showing settings of existing printers, if any. Click “add printer” and fill in a useful name and optionally a location & description.
“Continue” on and select “LPD/LPR Host or Printer” as the device type for your CanonBub printer. Then “continue” and fill in the URI. The server address is DragaXP for dynamic addressing and 192.168.1.1 for fixed addressing – and the exact server queuename is CanonBub. So for dynamic (DHCP) addressing use this address –> lpd://DragaXP/CanonBub and for fixed addressing use this –> lpd://192.168.2.4/CanonBub. Next select the model and the printer driver. Finally, you can set the default printer and test the connectivity to the Windows server. You should now be printing from Linux_To_Windows via LPD
That’s all for the cups network client on Linux folks. It’s really very easy but ONLY if you know how first.
Setting up a Linux client using Samba’s SMB/CIFS Protocol (alternative to LPD)
This method is an alternative to the one above which used the LPD protocol via cups network printing. This one uses the SMB protocol via Samba.
Check that Samba has been configured for cups printing. The [global] entry will contain at least these lines if it has been configured for cups printing.
[global] printing = cups printcap name = cups
Open cups admin on http://localhost:631 and execute these steps:
- Open Printers and Add Printer
- Enter the name CanonBub. This becomes the queuename. You can fill in the optional Locationand Description to suit.
- In Device type choose Windows Printer via SAMBA from the drop-down list
- Fixed IP: In Device URI enter smb://workgroup/username:firstname.lastname@example.org/CanonBub, where “username”, “password” and “workgroup” are real and give access to the server.
- Dynamic IP: In Device URI enter smb://workgroup/username:password@DragaXP/CanonBub, where “username”, “password” and “workgroup” are real and give access to the server.
- Choose the printer driver from the cups database on the final screens
- Execute a Print Test Page and you should be printing from Linux_To_Windows via Samba
OK folks that it for the Samba client on Linux and for this Tutorial.
Credits: This tutorial was made possible from advice given by broch and winxp_escapee in the Suse Linux Support Forum..
Hope this Tutorial makes life a bit easier for you.