Tabla de Contenidos

Samba as a Print Server

Introduction

This HowTo will provide you an easy guide to setup Samba to act as a Windows print server including Point'n'Click printer driver installation for users.

This HowTo is valid for Samba 3 and 4 print server installations .

Some definitions

Driver models


Supported by Samba: Printer driver version 3 (Windows 2000 to Windows 8).

Currently not supported by Samba: Printer driver version 4 (Windows 8).

Print server backend


The following sub-chapters will give you a short overview on possible backends, including adding a new network printer, we'll use in our later examples for sharing it by Samba.

The examples setup a RAW printer (content is send directly to the device). We don't use filters or drivers on the backend, because a RAW printer allows us to render the output on the workstation and use the printer specific driver.

We assume here, that you have the print server backend already basically configured and it's running, so printers can be added next.

CUPS


CUPS is currently the most widely used spool system in *nix environments and shipped with most distributions. Samba has built-in support and defaults to CUPS if the development package (aka header files and libraries) could be found at compile time.

Basically all sorts of files can be printed with CUPS, but using a Postscript or a RAW printer driver will give you the most benefit in combination with the Windows printer driver, because then all settings can be controlled on the Windows client.

Adding a new printer

 # LPD protocol
 lpd://hostname/queue

 # Internet Printing Protocol
 ipp://hostname/ipp/port

 # Forwarding the jobs to a Windows print server.
 # Hint: Vista and higher, don't allow anonymous connects by default, 
 # so you must provide a username and  password.
 smb://username:password@domain/servername/printername

LPD


This was the first widely used printing system and still runs on many servers. It is very simple to install and configure. There are different implementations of LPD servers, like the often used LPRng.

Adding a new printer

 PRINTERNAME:sd=/path/to/spool/directory:sh:mx=0:mc=0:rm=IP_or_DNS_Name
 # checkpc -f
 # service lpd restart
 # lpq -P PRINTERNAME
 Printer: PRINTERNAME@SAMPRINTSERVER (dest PRINTERNAME@IP_or_DNS_Name)
  Queue: no printable jobs in queue
 Ready

 no entries

Configuring Samba as print server


General


Granting print operator privileges

Users or groups, who should be able to administrate printers on your server, have to be granted the “SePrintOperatorPrivilege” privilege. This is required on member servers, as they have their own, local SAM database. It is recommended, to grant it to a domain group, because changes can be done quick and easily with the typical user management tools like ADUC.

The following example grants the privilege to the domain group “Domain Admins”:

 # net rpc rights grant 'SAMDOM\Domain Admins' SePrintOperatorPrivilege -Uadministrator

Existing privileges you can reviewed by:

 # net rpc rights list accounts -Uadministrator

Setup the [printers] share

This share defines general information about your printing backend. See the “[printers]” section in the man page for additional information.

 [printers]
     path = /var/spool/samba
     printable = yes
     printing = CUPS|LPRNG|...
 # smbd -b | grep CUPS
    HAVE_CUPS_CUPS_H
    HAVE_CUPS_LANGUAGE_H
    HAVE_CUPS
    HAVE_LIBCUPS

If you don't get any output, make sure, that the CUPS header files and libraries are installed and recompile Samba with –with-cups.

 # mkdir -p /var/spool/samba/
 # chmod 1777 /var/spool/samba/

Setup the [print$] share

To enable Point'n'Print support, a share named “print$” must exist. This share name is hardcoded in Windows clients and can't be choosen.

 [print$]
     path = /srv/samba/Printer_drivers
     comment = Printer Drivers
     writeable = yes
 # mkdir -p /srv/samba/Printer_drivers/
 BASEDIR=/srv/samba/Printer_drivers
 for i in COLOR IA64 W32ALPHA W32MIPS W32PPC W32X86/{2,3} WIN40 x64; do 
     mkdir -p $BASEDIR/$i;
 done
 # chgrp -R "SAMDOM\Domain Admins" /srv/samba/Printer_drivers/
 # chmod -R 2755 /srv/samba/Printer_drivers/

If you're running Samba 4.x, you can set the ACLs on the print$ share, throught Windows. Your benefit would be, that you can use the full Windows ACLs. Have a look at the Setup and configure file shares HowTo. It describes detailed the process, how to set permissions. The suggested filesystem permissions for the print$ share are:

Sharing a printer with Samba


 [MyDemoPrinter]
     path = /var/spool/samba/
     browseable = yes
     printable = yes
     printer name = Printername_in_backend
 # smbcontrol all reload-config

FAQ


An uploaded driver is not shown in the list, when trying to associate it with a printer


Windows clients only permit associating a driver with a printer, when the uploaded driver matches the architecture reported by the spoolss server. Samba reports “Windows NT x86” by default.

This causes, that when you had uploaded just a 64-bit driver, you won't see it in the list, when you try to associate it with the printer it's “advanced” tab.

There are three ways to workaround:

 spoolss: architecture = Windows x64

Point'n' Print doesn't deliver the drivers on all architectures


Make sure that you have uploaded exactly the same driver for that printer for all architectures. E. g. “HP Universal Printing PS” for x86 and “HP Universal Printing PS (v5.5.0)” for x64 wouldn't match, even if they are shipped in the same driver package!