Section 7.3. Samba and CUPS


7.3. Samba and CUPS

CUPS servers are becoming more and more common in today's networks. As previously mentioned, Samba does not require external commands to be able to communicate with the CUPS printer daemon (cupsd). Support for this feature must be detected at compile time, however. By default, the configure script attempts to locate the CUPS header files and development libraries. If you wish to force Samba to build with CUPS support and fail if it cannot, use the --enable-cups option when running configure:

 $ ./configure --enable-cups .... checking for cups-config... /usr/bin/cups-config .... 

Once support is detected, you can verify that the resulting smbd does in fact have support for CUPS printers by looking for HAVE_CUPS in the build options output from smbd:

 $ smbd -b | grep CUPS     HAVE_CUPS 

Configuring Samba to work with cupsd is by far the easiest of all the printing types. All of the printing commands from Table 7-2 can be omitted and our example [hp2100] share can be reduced to:

 [hp2100]     printing = cups     print ok = yes     comment = Classroom laser printer in RM 114     path = /var/spool/samba 

This configuration assumes that Samba and the CUPS server are running on the same host. Samba can use a cupsd process running on a different machine by defining the cups server parameter in the [global] section of smb.conf. The default behavior is to use the server specified in the CUPS client.conf configuration file or defined by the CUPS_SERVER environment variable. The value should be either the DNS name or IP address of the remote server:

     cups server = cups.plainjoe.org 

CUPS allows something that is hard to do on other printing systems: you can choose when a document should be processed by the printer's filter and when the document should bypass the filter. Thus, a single CUPS print queue can be used to process raw print jobs from Windows clients and PostScript files from Unix clients. In order to do this, add the cups options parameter to the print share definition. Any number of generic CUPS arguments can be set in this parameter using a list of comma-separated options. In the following example, we just tell Samba to inform CUPS that this job is ready to be sent directly to the printer:

 [hp2100]     printing = cups     print ok = yes     comment = Classroom laser printer in RM 114     path = /var/spool/samba     cups options = "raw" 

An alternative way to let a printer serve a dual purpose is to create two queues per printer, one to be used by Samba and the other to process jobs from Unix clients.

All of this ease of use is not without a price. The easier something is to configure, the more difficult it is to troubleshoot when things do not function correctly. When debugging Samba/CUPS printers, make sure to consult the cupsd logfiles as well as Samba's logs.




Using Samba
Using Samba: A File and Print Server for Linux, Unix & Mac OS X, 3rd Edition
ISBN: 0596007698
EAN: 2147483647
Year: 2004
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net