Printing with CUPS in the most basic smb.conf setup in Samba-3.0 (as was true for 2.2.x) only needs two settings: printing = cups and printcap = cups. CUPS does not need a printcap file. However, the cupsd.conf configuration file knows of two related directives that control how such a file will be automatically created and maintained by CUPS for the convenience of third-party applications (example: Printcap /etc/printcap and PrintcapFormat BSD ). Legacy programs often require the existence of a printcap file containing printer names or they will refuse to print. Make sure CUPS is set to generate and maintain a printcap file. For details, see man cupsd.conf and other CUPS-related documentation, like the wealth of documents on your CUPS server itself: http://localhost: 631/documentation.html .
18.2.1 Linking smbd with libcups.so
Samba has a special relationship to CUPS. Samba can be compiled with CUPS library support. Most recent installations have this support enabled. Per default, CUPS linking is compiled into smbd and other Samba binaries. Of course, you can use CUPS even if Samba is not linked against libcups.so ” but there are some differences in required or supported configuration.
When Samba is compiled against libcups , printcap = cups uses the CUPS API to list printers, submit jobs, query queues, and so on. Otherwise it maps to the System V commands with an additional -oraw option for printing. On a Linux system, you can use the ldd utility to find out details (ldd may not be present on other OS platforms, or its function may be embodied by a different command):
root# ldd 'which smbd' libssl.so.0.9.6 => /usr/lib/libssl.so.0.9.6 (0x4002d000) libcrypto.so.0.9.6 => /usr/lib/libcrypto.so.0.9.6 (0x4005a000) libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000) [....]
The line libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000) shows there is CUPS support compiled into this version of Samba. If this is the case, and printing = cups is set, then any otherwise manually set print command in smb.conf is ignored . This is an important point to remember!
18.2.2 Simple smb.conf Settings for CUPS
To summarize, Example 18.1 shows simplest printing-related setup for smb.conf to enable basic CUPS support:
Example 18.1 Simplest printing-related smb.conf
[global] load printers = yes printing = cups printcap name = cups [printers] comment = All Printers path = /var/spool/samba browseable = no public = yes guest ok = yes writable = no printable = yes printer admin = root, @ntadmins
This is all you need for basic printing setup for CUPS. It will print all graphic, text, PDF, and PostScript files submitted from Windows clients. However, most of your Windows users would not know how to send these kinds of files to print without opening a GUI application. Windows clients tend to have local printer drivers installed, and the GUI application's print buttons start a printer driver. Your users also rarely send files from the command line. Unlike UNIX clients, they hardly submit graphic, text or PDF formatted files directly to the spooler. They nearly exclusively print from GUI applications with a " printer driver " hooked in between the application's native format and the print-data-stream. If the backend printer is not a PostScript device, the print data stream is " binary ," sensible only for the target printer. Read on to learn which problem this may cause and how to avoid it.
18.2.3 More Complex CUPS smb.conf Settings
Example 18.2 is a slightly more complex printing-related setup for smb.conf . It enables general CUPS printing support for all printers, but defines one printer share, which is set up differently.
Example 18.2 Overriding global CUPS settings for one printer
[global] printing = cups printcap name = cups load printers = yes [printers] comment = All Printers path = /var/spool/samba public = yes guest ok = yes writable = no printable = yes printer admin = root, @ntadmins [special_printer] comment = A special printer with his own settings path = /var/spool/samba-special printing = sysv printcap = lpstat print command = echo "NEW: 'date': printfile %f" >> /tmp/smbprn.log ; \ echo " 'date': p-%p s-%s f-%f" >> /tmp/smbprn.log ; \ echo " 'date': j-%j J-%J z-%z c-%c" >> /tmp/smbprn.log : rm %f public = no guest ok = no writeable = no printable = yes printer admin = kurt hosts deny = 0.0.0.0 hosts allow = turbo_xp, 10.160.50.23, 10.160.51.60
This special share is only there for testing purposes. It does not write the print job to a file. It just logs the job parameters known to Samba into the /tmp/smbprn.log file and deletes the jobfile. Moreover, the printer admin of this share is " kurt " (not the " @ntadmins " group ), guest access is not allowed, the share isn't published to the Network Neighborhood (so you need to know it is there), and it only allows access from only three hosts. To prevent CUPS kicking in and taking over the print jobs for that share, we need to set printing = sysv and printcap = lpstat.