1/11/2014

Samba as a print server - SambaWiki

Samba as a print server
From SambaWiki

Contents
1 General
1.1 Introduction
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 operator privileges
3.1.3 Setup the [printers] share
3.1.4 Setup the [print$] share
3.2 Sharing a printer with Samba

General
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
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://wiki.samba.org/index.php/Samba_as_a_print_server

1/7

microsoft.85%29.php/Samba_as_a_print_server 2/7 . because a RAW printer allows us to render the output on the workstation and use the printer specific driver. Point'n'Print Windows 2000 and later support the abillity to automatically download and install drivers from the server including preconfiguring. We assume here. The examples setup a RAW printer (content is send directly to the device). Printer forms Windows is already shipped with an amount of forms. 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. We don't use filters or drivers on the backend. because then all settings can be controlled on the Windows client. Samba has built-in support and defaults to CUPS if the development package (aka header files and libraries) could be found at compile time. that you have the print server backend already basically configured and it's running.com/enus/library/windows/hardware/hh706306%28v=vs. that converts the printed data to a printer specific form.org/index. we'll use in our later examples for sharing it by Samba. The driver for each shared printer can be preconfigured with default values.org) is currently the most widely used spool system in *nix environments and shipped with most distributions. without special permissions. CUPS CUPS (http://www.cups. altought the printer is able to do it. the client could not use this.SambaWiki A piece of software. but using a Postscript or a RAW printer driver will give you the most benefit in combination with the Windows printer driver. that define the typical paper sizes. so printers can be added next. including adding a new network printer.aspx) (Windows 8) Print server backend The following sub-chapters will give you a short overview on possible backends.samba. The installation can be done by ordinary users. https://wiki. when connecting a printer. Basically all sorts of files can be printed with CUPS.1/11/2014 Samba as a print server . If a formular isn't known to the print server.

# checkpc -f # service lpd restart The following command allows you query the state of the printer: # lpq -P PRINTERNAME https://wiki. you simply need to add the following line to your 'printcap' (typically '/etc/printcap'). smb://username:password@domain/servername/printername Enter a name for the printer When you reached the step. don't allow anonymous connects by default. It is very simple to install and configure. For the different options used in the example. so you must provide a username and password.org/) . There are different implementations of LPD servers.1/11/2014 Samba as a print server . choose „Raw“ for both.org/index. Adding a new printer To add a new network printer. like the often used LPRng (http://www. # Hint: Vista and higher. to take the changes affect. Save the new added printer. where to choose the vendor and model. On the „Administration“ tab click the „Add Printer“ button. run the following command to create the LPD spool directory and restart/reload the service. because the rendering is already done later by the Windows driver. PRINTERNAME:sd=/path/to/spool/directory:sh:mx=0:mc=0:rm=IP_or_DNS_Name After adding the new printer entry. how your printer is connected and enter the appropriate URL.lprng.samba. Choose the way.SambaWiki Adding a new printer Open the CUPS admin webfrontend (https://servername:631/admin). LPD This was the first widely used printing system and still runs on many servers. see 'man printcap'.php/Samba_as_a_print_server 3/7 . Examples: # LPD protocol lpd://hostname/queue # Internet Printing Protocol ipp://hostname/ipp/port # Forwarding the jobs to a Windows 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.org/index. it can directly start to talk to the daemon and e. That's why it is recommended to use at least this versions! spoolssd is a feature. In the past.0. Since Samba 4.17 and 4. a smbd child process was forked. you can configure.1/11/2014 Samba as a print server .0. that initializes the printcap cache. what causes a performance improvement. you'll see additional smbd processes. g.7.1. 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. The master process is a simple daemon with a small memory footprint. that spoolssd is started as forked processes. which will handle only spoolss requests. ask any information about the printer without any delay. If enabled.samba. you will discover additional smbd processes.conf: rpc_server:spoolss = external rpc_daemon:spoolssd = fork After you have restarted Samba. To enable spoolssd. when a print job came in. If you are having a huge printcap cache and it needs to be updated first.php/Samba_as_a_print_server 4/7 . add the following to the [global] section of your smb. spoolss. etc. When a connection comes in. introduced in Samba 4. that only forks and kills childs serving the spoolss pipe. the client could hang for several seconds. that increases the performance in printing affairs.

even a lower value has been configured) spoolssd is still a new feature. as they have their own. please report it at https://bugzilla. that the CUPS header files and libraries are installed and recompile Samba with --with-cups.SambaWiki spoolssd:prefork_min_children = 5 spoolssd:prefork_max_children = 25 spoolssd:prefork_spawn_rate = 5 spoolssd:prefork_max_allowed_clients = 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 prefork_max_ Number of clients.. make sure. to grant it to a domain group.conf [printers] path = /var/spool/samba printable = yes printing = CUPS|LPRNG|. If you may encounter any bug.1/11/2014 Samba as a print server . 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. Add the new section to your smb. https://wiki. who should be able to administrate printers on your server. a child process should be responsible for Minimum lifetime of a child process (60 seconds is the minimum.org/index. See the „[printers]“ section in the man page for additional information.php/Samba_as_a_print_server 5/7 . 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.. local SAM database.samba.org/. It is recommended. This is required on member servers. because changes can be done quick and easily with the typical user management tools like ADUC. Granting print operator privileges Users or groups. to get it fixed soon.samba. make sure. If you choose CUPS as backend. have to be granted the „SePrintOperatorPrivilege“ privilege.

done At last. defined in the „[printer]“ share. Add the share to your smb. while the group you have granted print operator privileges to. for Samba 3. Set the appropriate permissions. The suggested filesystem permissions for Windows ACLs on the print$ share are: Creator Owner: Full control (Subfolders and files only) Authenticated Users: Read & execute. has write permissions to upload printer drivers. 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. List folder contents. Have a look at the Setup and configure file shares documentation for further details.x) # chgrp -R „SAMDOM\Domain Admins“ /srv/samba/Printer_drivers/ # chmod -R 2755 /srv/samba/Printer_drivers/ https://wiki. set the permissions. subfolders and files) Domain Admins: Full control (This folder.org/index. a share named „print$“ must exist.samba.SambaWiki The next step is to create the samba spool directory. This share name is hardcoded in Windows clients and can't be choosen. depending to your needs.php/Samba_as_a_print_server 6/7 . subfolders and files) ACL example for POSIX ACLs on the print$ share (e. The benefit of Windows ACLs are. subfolders and files) System: Full control (This folder.1/11/2014 Samba as a print server . If you're running Samba 4 and later. Read (This folder. that you can use the full Windows ACLs set.conf [print$] path = /srv/samba/Printer_drivers comment = Printer Drivers writeable = yes Create the folder. do mkdir -p $BASEDIR/$i. you are having the choice to use POSIX or Windows ACLs on the print$ share. It is recommended that normal users just have read-only access to the share. # mkdir -p /var/spool/samba/ # chmod 1777 /var/spool/samba/ Setup the [print$] share To enable Point'n'Print support. g. The following examples are granting write permissions to the „Domain Admins“ group.3} WIN40 x64.

org/index. reload the Samba configuration: # smbcontrol all reload-config Retrieved from "https://wiki.. To bring the changes live. Content is available under the CC-GNU GPL v2 or later unless otherwise noted.samba.1/11/2014 Samba as a print server . https://wiki. at 18:35. queue..php/Samba_as_a_print_server 7/7 .samba.org/index.SambaWiki Sharing a printer with Samba For each printer you want to share via Samba.php?title=Samba_as_a_print_server&oldid=9276" This page was last modified on 22 September 2014. you have to create a separate share (unless you have "load printers = yes" defined in your smb.conf).683 times. The following is an example: [MyDemoPrinter] path = /var/spool/samba/ browseable = yes printable = yes printer name = Printername_in_backend Set the „printer name“ parameter to the name of your corresponding CUPS/LPD/. This page has been accessed 205.