1.107.4 Install and configure local and remote printers Weight 1 1.107.4 Install and configure local and remote printers Weight 1 Linux Professional Institute Certification — 102 Andrew Eager Context Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Andrew Eager Geoff Robertson Nick Urbanik This document Licensed under GPL—see section 10 Print Filters License of this document 2005 July Outline 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document Context Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file printcap file syntax Creating spool directory and log file Access Control Print Filters License of this document Topic 107 Printing [3] Where we are up to 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources Overview of Linux Printing Setting up a Printer 1.107.2 Manage printers and print queues [1] 1.107.3 Print files [1] 1.107.4 Install and configure local and remote printers [1] /etc/printcap file spool dir and log file Access Control Print Filters License of this document Description of Objective 1.107.4 Install and configure local and remote printers [1] 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources Candidates should be able to install a printer daemon, install and configure a print filter (eg apsfilter, magicfilter). This objective includes making local and remote printers accessible for a linux system, including postscript, non-postscript and samba printers. Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document Key files, terms, and utilities include: 1.107.4 Install and configure local and remote printers [1] 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources lpd The Printing daemon /var/spool/lpd/* — Spooler directories /etc/printcap — lpd Configuration file /etc/apsfilter/* /var/lib/apsfilter/* /etc/magicfilter/* Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document Resources of interest 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources Overview of Linux Printing Printing-HOWTO Printing-Usage-HOWTO www.linuxprinting.org Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document Linux Printing There are several packages available for linux printing: LPR LPRng Cups 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document Previously LPR (or LPRng) was the default on most Linux distros. . . . . . but now Cups is the default. Major components of the LPR subsystem are: lpd — The printing daemon lpr — A tool to submit jobs into the queue lprm — A tool to remove jobs from the queue lpq — A tool to view jobs in the queue lpc — An administration tool for printers and queues The commands in red are also provided by Cups. Installing a Printer 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources There are two ways to install a printer under Linux: The easy way! — Use a GUI like printtool or system-config-printer on Fedora systems. The hard way: Edit /etc/printcap Create the spool directory Touch the log file Restart lpd Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document printcap — The configuration file 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context /etc/printcap contains information about all printers on the system (including remote printers) An example looks like: Objective Resources Overview of Linux Printing Setting up a Printer HPLjet|lp|lp0:\ /etc/printcap file printcap file syntax :ml=0:\ spool dir and log file :mx=0:\ Access Control :sd=/var/spool/lpd/HPLjet:\ Print Filters :sh:\ License of this document :lp=/dev/lp0:\ :lf=/var/spool/lpd/HPLjet/log:\ :if=/usr/share/printconf/util/mf_wrapper: printcap — The configuration file Syntax 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Key points to note about printcap format: Comments start with a ’#’ Any line not starting with a colon or pipe is the start of a printer definition Each line of a definition ends in a backslash except the last line lpd must be restarted each time /etc/printcap is edited Spool directory and log file need to be created manually it is not created automatically by LPD Resources Overview of Linux Printing Setting up a Printer /etc/printcap file printcap file syntax spool dir and log file Access Control Print Filters License of this document printcap — The configuration file 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective if Define the input filter lf Define the printer log file lo Define the lock file created when printer is in use mx Define the maximum size of a print job rm Specify printer is on remote machine. Eg :rm=192.168.222.254: rp Define remote printer name. Eg :rp=HPLjet: sh Tell lpd not to print banner pages sd Specify spool directory Resources Overview of Linux Printing Setting up a Printer /etc/printcap file printcap file syntax spool dir and log file Access Control Print Filters License of this document Creating spool directory and log file 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document The spool directory should be owned by user lp and have permissions set to 700: $ sudo mkdir /var/spool/lpd/HPLjet ← $ sudo chown lp:lp /var/spool/lpd/HPLjet ← $ sudo chmod 0700 /var/spool/lpd/HPLjet ← The log file should have permissions set to 660 and have the same ownership as the spool directory: $ sudo touch /var/spool/lpd/HPLjet/log ← $ sudo chown lp:lp /var/spool/lpd/HPLjet/log ← $ sudo chmod 0660 /var/spool/lpd/HPLjet/log ← Controlling printer access 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Printer access is controlled through /etc/hosts.lpd If the file does not exist, all access is granted If the file exists, only those in the list will be granted access The format is: [host [user]] Example: All access from box2.c222, only greg from box3.c222 box2.c222 box3.c222 greg Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document Print Filters 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document A print filter converts data to be printed into a language that your printer understands There are several print filter packages: Foomatic Apsfilter Magicfilter Key Point Summary 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Most Linux systems previously used LPR (or LPRng), but now most Linux systems use Cups Local & remote printer configs are stored in /etc/printcap The print spool directory & log file must be created manually Print access is controlled using /etc/hosts.lpd Print filters convert different data types to a language understood by the printer The lpd daemon is responsible for getting jobs from the user, putting them through the filter and delivering them to the spool directory. Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document Key Point Summary 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources The lpc program is used to control the printer and print spools The lpq program is used to view the print queues The lprm program is used to remove jobs from the queues The lpr program is used to submit jobs into the queue. Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document Topics Covered Context Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file printcap file syntax Creating spool directory and log file Access Control Print Filters License of this document 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document License Of This Document 1.107.4 Install and configure local and remote printers Weight 1 Andrew Eager Context Objective Copyright c 2005, 2002 Andrew Eager , Geoffrey Robertson , Nick Urbanik . You can redistribute modified or unmodified copies of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation—either version 2 of the License or (at your option) any later version. Resources Overview of Linux Printing Setting up a Printer /etc/printcap file spool dir and log file Access Control Print Filters License of this document