1/11/2014
Samba as a pr i nt ser ver - SambaWi ki
Samba as a print server From SambaWiki
Contents 1 General 1.1 Introducti Introduction on 1.2 Some definitions 1.3 Driver models 2 Print server backend 2.1 CUPS 2.1.1 Adding a new printer 2.2 LPD 2.2.1 Adding a new printer 3 Configuring Samba as print server 3.1 General 3.1.1 Enabling spoolssd (optional) 3.1.2 Granting print o perator perator priv privileges eges 3.1.3 Setup the [printers] share [printers] share 3.1.4 Setup the [print$] share 3.2 Sharing Sharing a printer with Samba
General Introduction Introduction This HowTo HowTo will pr ovide ovide 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 Printer share Each printer is shared by a name. During the printing process, the client sends the printjob to it. Print server backend Samba can use e. g. CUPS, LPD/Lprng and other as backend. The print server forwards the job to local or network printers. Windows printer driver https://wi ki .samba.or g /i ndex.php/Samba_as_a_pr i nt_ser ver
1/7
1/11/2014
Samba as a print server - SambaWiki
A piece of software, that converts the printed data to a printer specific form. The driver for each shared printer can be preconfigured with default values. Point'n'Print Windows 2000 and later support the abillity to automatically download and install drivers from the server including preconfiguring, when connecting a printer. The installation can be done by ordinary users, without special permissions. Printer forms Windows is already shipped with an amount of forms, that define the typical paper sizes. If a formular isn't known to the print server, the client could not use this, altought the printer is able to do it.
Driver models Supported by Samba: Printer driver version 3 (Windows 2000 to Windows 8) Currently not supported by Samba: Printer driver version 4 (http://msdn.microsoft.com/enus/library/windows/hardware/hh706306%28v=vs.85%29.aspx) (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 (http://www.cups.org) 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.
https://wiki.samba.org/index.php/Samba_as_a_print_server
2/7
1/11/2014
Samba as a print server - SambaWiki
Adding a new printer Open the CUPS admin webfrontend (https://servername:631/admin). On the „Administration“ tab click the „Add Printer“ button. Choose the way, how your printer is connected and enter the appropriate URL. Examples: # 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
Enter a name for the printer When you reached the step, where to choose the vendor and model, choose „Raw“ for both, because the rendering is already done later by the Windows driver. Save the new added printer.
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 (http://www.lprng.org/) .
Adding a new printer To add a new network printer, you simply need to add the following line to your 'printcap' (typically '/etc/printcap'). For the different options used in the example, see 'man printcap'. PRINTERNAME:sd=/path/to/spool/directory:sh:mx=0:mc=0:rm=IP_or_DNS_Name
After adding the new printer entry, run the following command to create the LPD spool directory and restart/reload the service, to take the changes affect. # checkpc -f # service lpd restart
The following command allows you query the state of the printer: # lpq -P PRINTERNAME https://wiki.samba.org/index.php/Samba_as_a_print_server
3/7
1/11/2014
Samba as a print server - SambaWiki
Printer: PRINTERNAME@SAMPRINTSERVER (dest PRINTERNAME@IP_or_DNS_Name) Queue: no printable jobs in queue Ready no entries
Configuring Samba as print server General Enabling spoolssd (optional) Note: Some features of spoolssd were broken before 4.0.17 and 4.1.7. That's why it is recommended to use at least this versions!
spoolssd is a feature, introduced in Samba 4.0, that increases the performance in printing affairs. In the past, when a print job came in, a smbd child process was forked, that initializes the printcap cache, spoolss, etc. If ou are having a huge printcap cache and it needs to be updated first, the client could hang for several seconds. Since Samba 4, you can configure, that spoolssd is started as forked processes. If enabled, you'll see additional smbd processes, which will handle only spoolss requests. The master process is a simple daemon with a small memory footprint, that only forks and kills childs serving the spoolss pipe. When a connection comes in, it can directly start to talk to the daemon and e. g. ask any information about the printer without any delay, what causes a performance improvement. To enable spoolssd, add the following to the [global] section of your smb.conf: rpc_server:spoolss = external rpc_daemon:spoolssd = fork
After you have restarted Samba, you will discover additional smbd processes, that handle spoolss requests: With spoolssd enabled after startup: 30903 smbd 30912 \_ smbd 30913 \_ smbd 30914 \_ smbd 30915 \_ smbd 30916 \_ smbd 30917 \_ smbd 30918 \_ smbd 30920 \_ smbd 30921 \_ smbd 30922 \_ smbd 30923 \_ smbd 30924 \_ smbd
With spoolssd disabled (default): 30955 smbd 30963 \_ smbd
You can adjust the daemons behavior through the following parameters (the values in the examples are the defaults):
https://wiki.samba.org/index.php/Samba_as_a_print_server
4/7
1/11/2014
Samba as a print server - SambaWiki
spoolssd:prefork _min_children = 5 spoolssd:prefork _max_children = 25 spoolssd:prefork _spawn_rate = 5 spoolssd:prefork _max_allowed_cli ents = 100 spoolssd:prefork _child_min_life = 60
# # # # # #
Minimum number of child processes Maximum number of child processes Start (fork) x new childs if one connection comes in (up to prefor Number of clients, a child process should be responsible for Minimum lifetime of a child process (60 seconds is the minimum, even a lower value has been configured)
spoolssd is still a new feature. If you may encounter any bug, please report it at https://bugzilla.samba.org/, to get it fixed soon.
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. Add the new section to your smb.conf [printers] path = /var/spool/samb a printable = yes printing = CUPS|LPRNG|...
If you choose CUPS as backend, make sure, that your smbd is compiled with CUPS support: # 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. https://wiki.samba.org/index.php/Samba_as_a_print_server
5/7
1/11/2014
Samba as a print server - SambaWiki
The next step is to create the samba spool directory, defined in the „[printer]“ share. Set the appropriate permissions, depending to your needs. # 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. Add the share to your smb.conf [print$] path = /srv/samba/Prin ter_drivers comment = Printer Drivers writeable = yes
Create the folder, that will contain the drivers later: # mkdir -p /srv/samba/Printer_drivers/
Next we create the required directory structure for the print$ share (newer versions of Samba will create it on the fly): BASEDIR=/srv/samba/Printer_drivers for i in COLOR IA64 W32ALPHA W32MIPS W32PPC W32X86/{2,3} WIN40 x64; do mkdir -p $BASEDIR/$i; done
At last, set the permissions. It is recommended that normal users just have read-only access to the share, while the group you have granted print operator privileges to, has write permissions to upload printer drivers. The following examples are granting write permissions to the „Domain Admins“ group. If you're running Samba 4 and later, you are having the choice to use POSIX or Windows ACLs on the print$ share. The benefit of Windows ACLs are, that you can use the full Windows ACLs set. Have a look at the Setup and configure file shares documentation for further details. The suggested filesystem permissions for Windows ACLs on the print$ share are: Creator Owner: Full control (Subfolders and files only) Authenticated Users: Read & execute, List folder contents, Read (This folder, subfolders and files) System: Full control (This folder, subfolders and files) Domain Admins: Full control (This folder, subfolders and files) ACL example for POSIX ACLs on the print$ share (e. g. for Samba 3.x) # chgrp -R „SAMDOM\Domain Admins“ /srv/samba/Printer_drivers/ # chmod -R 2755 /srv/samba/Printer_drivers/ https://wiki.samba.org/index.php/Samba_as_a_print_server
6/7
1/11/2014
Samba as a print server - SambaWiki
Sharing a printer with Samba For each printer you want to share via Samba, you have to create a separate share (unless you have "load printers = yes" defined in your smb.conf). The following is an example: [MyDemoPrinter] path = /var/spool/samb a/ browseable = yes printable = yes printer name = Printername_in_ backend
Set the „printer name“ parameter to the name of your corresponding CUPS/LPD/... queue. To bring the changes live, reload the Samba configuration: # smbcontrol all reload-config
Retrieved from "https://wiki.samba.org/index.php?title=Samba_as_a_print_server&oldid=9276"
This page was last modified on 22 September 2014, at 18:35. This page has been accessed 205,683 times. Content is available under the CC-GNU GPL v2 or later unless otherwise noted.
https://wiki.samba.org/index.php/Samba_as_a_print_server
7/7