CUPS Windows Printserver with Postscript Driver

Simple steps to manage printers using a uniqe printer driver for Windows

Nov. 21, 2018

Prepare

Install Samba and Cups.
Using Debian or Ubuntu, Samba's configuration files are stored in /etc/samba
and Cups's configs are in /etc/cups

Samba integration

Samba can be configured in many ways and there are plenty of tutorials. Of course the best documentation is on Samba's homepage itself.

In most environments there will be an existing Windows domain controller, so Samba's smb.conf file could have these entries.

Please do not copy paste this example into Your running config without thinking about each simple entry!
Also make sure that the system's hostname is set properly, e.g. "<printserver>" like in this example.

[global]
security = ads
server string = <printserver>
workgroup = WORKGROUP
realm = WORKGROUP.LOCAL
printing = cups
winbind use default domain = yes
winbind enum users = yes
winbind enum groups = yes
winbind separator = +
winbind nested groups = no
idmap config * : backend = autorid
idmap config * : range = 3000000-19999999
idmap config * : rangesize = 1000000

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
read only = yes
printable = yes
create mask = 0700
admin users = root, @WORKGROUP+it, @WORKGROUP+domänen-admins

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = no
guest ok = yes
read only = yes
admin users = root, @WORKGROUP+domain-admins
write list = root, @WORKGROUP+domain-admins

[spool_cups]
comment = CUPS Drucker Warteschlange
browseable = yes
guest ok = yes
path = /var/spool/cups/
read only = yes
force user = root

Driver Files

root@<printserver>:/var/lib/samba/printers# find -iname "*dll"

x64/ps5ui.dll
x64/pscript.hlp
x64/pscript.ntf
x64/pscript5.dll
W32X86/ps5ui.dll
W32X86/pscript.hlp
W32X86/pscript.ntf
W32X86/pscript5.dll

Where to get these files?
Every Windows installation has it's default printer drivers, so this would be the first source.
Maybe there is an installation disk for Windows Server 2008 32 Bit and Windows Server 2016 64 Bit.
These drivers would be perfectly matching...

Commandline or Cups Web Interface

For all administrative tasks you can choose between different types of interfaces.
Most popular is Cups's web interface on https://<printserver>:631/

It is also possible to use Windows to administer Cups printer drivers (see smb.conf Admin Users and of course the manual of smb.conf -> man smb.conf).

Architecture and Global Settings

One of the best features of Cups is keeping print jobs as PDF files.
Simply put these parameters in cups.conf via web interface.

PreserveJobFiles Yes
PreserveJobHistory Yes
MaxJobs 0
WebInterface Yes
BrowseWebIF Yes

Putting it all together

Here is a real life example.
Printers are labelled with numbers and with a name.
The numbers "141" and "142" represent cups printers and the name "Sales01" represents a cups class.
This setup makes sure, that a failed or failing printer has a backup.

The client prints to "Sales01", the print job will first be tried on printer 141 but if this one is e.g. offline or out of paper the job will be tried on printer 142.

Add Printers to Cups

lpadmin -p 141 -v socket://192.168.x.141:9100 -P 141.ppd
lpadmin -p 142 -v socket://192.168.x.142:9100 -P 141.ppd

Only one PPD-File is used in these commands.
Cups nevertheless creates a PPD for each printer in /etc/cups/ppd.

Add Printers to Class "Sales01"

lpadmin -p 141 -c Sales01
lpadmin -p 142 -c Sales01

Add Cups Class and all driver information to Samba's printer share

cupsaddsmb -U Administrator Sales01

Return

no analytics