UNIX System Administration Handbook - Evi Nemeth [434]
# chmod 775 /var/spool/lpd/howler-lw
If the lpd server is a real machine (and not just a smart printer), make sure you can print jobs from that machine before configuring network clients. To test printing from the client, use a sequence of commands similar to the following:
# lpc start howler-lw
# lpr -Phowler-lw /etc/motd
# lpq -Phowler-lw
Making Red Hat accept network print jobs
Before you try to spool jobs from across the network, make sure you can print locally. Then, add to your /etc/hosts.lpd file the clients from which you want to accept jobs.
Adding printers to FreeBSD
The default FreeBSD /etc/printcap file comes with some prebuilt examples of local and network printer configuration that you can refer to when adding your own printers. The printcap examples in the Red Hat section also work with the FreeBSD printing system (though the filters mentioned there are not included with FreeBSD).
By default, printing services on FreeBSD are disabled. To turn them on, change NO in the following line to YES in the /etc/rc.conf file:
lpd_enable="NO" # Run the line printer daemon.
None of FreeBSD’s printing commands (except perhaps lptcontrol) should surprise you. lptcontrol lets you configure your parallel port to use any of several different modes, such as interrupt-driven, polled, extended, and standard. To set your first parallel port (/dev/lpt0) to run in interrupt-driven mode, use lptcontrol as follows:
# lptcontrol -i -u 0
lptcontrol only changes the current state of the parallel port. If you want the port configured a certain way each time you boot, put the appropriate lptcontrol command in one of the system startup scripts.
Several useful printing examples and scripts are included in the FreeBSD handbook. It is on-line at www.freebsd.org.
Setting up a local printer under FreeBSD
The first parallel port on a FreeBSD machine is /dev/lpt0. The first serial port is usually /dev/ttyd0. Aside from the difference in device names, printcap configuration of local serial or parallel printers is almost identical to that in Red Hat (see page 733).
The FreeBSD distribution includes a relatively simple text filter, /usr/libexec/lpr/lpf, that does basic formatting, such as fixing carriage returns and indents, as well as converting from text to PostScript format.
Network printing configuration under FreeBSD
FreeBSD handles remote printers much like Red Hat, although the filters are different. Making local printers available to the network is also done similarly.
23.6 LPRNG
LPRng is a relatively new print spooler that is based on the BSD system. Currently maintained by Patrick Powell at AStArt Technologies, LPRng is a successful attempt to merge the best features of the Berkeley and SysV printing schemes.
LPRng replaces your current printing system with compatible but improved commands. All the common BSD commands are available. The most important SysV commands are also supported and are implemented as links to their BSD counterparts. For example, the lp command is a link to lpr and cancel is a link to lprm. The commands check to see how they were invoked and behave accordingly.
One of the most significant problems with the BSD printing system is the need for most of the printing software to run as root. In addition to having lpr clients run setuid to root, lpd filters also run as root. Because filters are often shell scripts, this is a frightening prospect.
LPRng solves the problem by allowing clients to run as normal users. In cases in which LPRng doesn’t have to interact with non-LPRng clients, even the printing daemon can run as a nonroot user. The package also adds lots of new security checking that is lacking in most BSD systems.
One of the more useful features of LPRng is its ability to produce verbose diagnostics and error messages. Instead of silently failing or returning a cryptic message, programs in this package give descriptive and helpful explanations of what went wrong.6
Although lpd supports access control through