The basic components of the LPRng system are the executables and the database files. This section deals with generating and installing the executable files.
ifhp filter source code from a
LPRng FTP Site.
This filter is used to support
PostScript,
PCL,
and text printers.Used to decompress many files in the LPRng and other distributions.
This is version of tar supports native Gzip compression and decompression and is used to generate the LPRng distribution.
LPRng assumes that GNU make (gmake) will be used during
the configuration and installation process.
If you do not have an ANSI C compiler, then please use the GCC compiler.
gcc compiler.The Open Source utility by Ian F. Darwin
can be obtained from
ftp://ftp.astron.com/pub/file.
This is a greatly improved version of the original UNIX file utility and
may be used by the ifhp filter to do file recognition.
GhostScript can be obtained from http://www.cs.wisc.edu/~ghost/ or http://www.ghostscript.com. GhostScript is a PostScript interpreter that allows you to translate PostScript to various printer compatible formats such as PCL, as well as displaying the code on a terminal. You might also want to get the PDF extensions that allows GhostScript to read and print PDF files.
Of course you will want to get the gv program that
uses GhostScript to display PostScript on an X terminal.
It can be obtained from
http://wwwthep.physik.uni-mainz.de/~plass/gv/
If make sure that you have
/usr/local/bin
in your path if you have installed
the GNU tools in the (standard) /usr/local/bin
directory.
This should be one of the first entries in the shell search PATH.
If you are compiling on a Solaris system
make sure that you have
/usr/ccs/bin
in your search path as well.
The /usr/local/bin entry must be before /usr/ccs/bin.
After doing this,
check to see that the GNU make utility
and not the default OS make is being used by default.
Use make -v to determine what version you have,
and if you have GNU make.
% make -v
GNU Make version 3.75, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96
By default,
the lpd server is started at system initialization time
and runs as ROOT (uid 0).
In order to provide a higher level of security,
LPRng will perform file operations as the non-privileged user
daemon and group daemon.
Use the appropriate system administration tools to
create a user and group daemon.
Most UNIX systems already have such a user.
User daemon must not have login capability.
The LPRng package consists of:
lpd - the LPD print server programlpr,
lpq,
lprm,
lpc -
and
lpstat,
client programs for printing,
status queries, job removal, server configuration,
and System V lpstat emulation respectively.printcap print queue database file
which is used by all the server and client programslpd.conf LPRng configuration options
which is used by all the server and client programslpd.perms permission information
which is used by the lpd server to control user actions.LPRng uses the configure facility
for configuration and installation.
Configure generates a set of Makefiles which are used
by the make program to compile and install software.
The following Makefile variables and values are set by configure
to specify the location of the LPRng software:
Directories:
Variable Value Default
${prefix} (/usr/local)
${exec_prefix} ${prefix} (/usr/local)
${bindir} ${exec_prefix}/bin (/usr/local/bin)
${sbindir} ${exec_prefix}/sbin (/usr/local/sbin)
${libexecdir} ${exec_prefix}/libexec (/usr/local/libexec)
${sysconfdir} ${prefix}/etc (/usr/local/etc)
${mandir} ${prefix}/man (/usr/local/man)
These are used for the following files:
Variable Files
${bindir} lpr, lprm, lpq, lpstat
${sbindir} lpc, checkpc, lpd
${libexecdir}/filters lpf, pclbanner, psbanner, lpbanner
${sysconfdir} lpd.conf, lpd.perms, printcap
${mandir}/man[1-9] man pages
You can set explicit values for the
prefix
bindir
sbindir
libexecdir
and
mandir variables using the --name=PATH
option.
For example:
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man
Variable Value Files
${bindir} /usr/bin /usr/bin/{lpr,lprm,lpq,lpstat}
${sbindir} /usr/sbin /usr/sbin/{lpc,checkpc,lpd}
${libexecdir}/filters /usr/libexec/filters \
/usr/libexec/filters{lpf, pclbanner, psbanner, lpbanner}
${sysconfdir} /etc /etc/{lpd.conf,lpd.perms,printcap}
${mandir}/man[1-9] /usr/share/man/man[1-9]/{man pages}
In addition to these general purpose options
configure has the following options to control
various system requirements.
--disable-setuidInstall the executables without setuid ROOT permissions. Non-setuid clients and programs are inherently more secure than SETUID programs, and system administrators would be well advised to install them without SETUID root permissions. Please see Security Considerations for more details about this option.
--disable-stripDo not strip the executables before installing. For debugging and diagnostic purposes.
--enable-priv_ports.Require connections to the lpd server
to come from a privileged port (range 1-1023).
By default
LPRng will allow connections from any port.
Please see
Security Considerations
for more details about this option.
--disable-force_localhost. The default LPRng configuration assumes that all printing will be done
via a lpd print spooler running on the local host system.
However,
many larger sites prefer that all users do their printing via a
few central servers,
and do not run
lpd servers on user systems.
The
--disable-force_localhost
configuration sets the default value of the force_localhost
value to false,
by default allowing the LPRng clients to connect directly to lpd servers
on remote hosts.
--disable-require_configfilesBy default, the
lpr,
lpq,
lpc, ...
clients require the lpd.conf and printcap files
to be present on the localhost.
The
--disable-require_configfiles
option removes this requirement.
--disable-kerberosDo not include support for Kerberos 5 authenticated transfers.
--with-lpddir=DIR. lpd executable directory (default ${sbindir}). For historical configuration compatibility.
--with-filterdir=DIR. Filter directory (default ${libexecdir}/filters). For historical configuration compatibility.
--with-lpd_conf_path=PATH. Path of lpd.conf file.
For historical configuration compatibility.
--with-lpd_perms_path=PATH Path of lpd.perms file.
For historical configuration compatibility.
--with-printcap_path=PATH Path of printcap file.
For historical configuration compatibility.
It is recommended that you use one of the following configurations:
./configure
use all configure's defaults,
/usr/local/{bin,sbin,libexec/filters,man}
requires a server to run on the local host
everything installed setuid ROOT
./configure --prefix=/usr --sysconfdir=/etc \
--mandir=/usr/share/man
executables and files in
/usr/{bin,sbin,libexec/filters}
/usr/share/man/man[0-9]
requires a server to run on the local host
everything installed setuid ROOT
./configure --prefix=/usr --sysconfdir=/etc \
--mandir=/usr/share/man --disable-force_localhost
executables and files in
/usr/{bin,sbin,libexec/filters}
/usr/share/man/man[0-9]
clients will connect to a remote server
Once you have decided on the configuration you want, you can now compile and install the software as follows:
gunzip -c LPRng-<version>.tgz | tar xvf -
OR with GNU tar
tar -zxvf LPRng-<version>.tgz
cd LPRng-<version>
./configure [ .... configuration options ]
gmake clean all
su # you must do the following commands as root
gmake install
# if you have not installed LPRng before,
# install default lpd.perms and lpd.conf file in /etc
if [ ! -f /etc/lpd.perms ]; then
make default;
fi;
# update permissions, create files needed for LPRng, check
# /etc/printcap file for problems. Do as root:
checkpc -f
If you are planning on using the ifhp filter,
then now would be a good time to
download it and install it as well.
Configure will install executables and files
in the following locations,
depending on the variable values
Variable Files
${libexecdir}/filters ifhp,textps
${sysconfdir} ifhp.conf
${mandir}/man[1-9] man pages
Use the same directory location options
for configure
as you did for the LPRng install.
gunzip -c ifhp-<version>.tgz | tar xvf -
OR with GNU tar
tar -zxvf ifhp-<version>.tgz
cd ifhp-<version>
./configure [ .... configuration options ]
gmake clean all
su # you must do the following commands as root
gmake install
The configure
script will determine the type of system and establish a set of defaults
for compilation and installation.
It is most unlikely that you will encounter problems with
configure.
If you do,
please send your problems to the LPRng mailing list at
lprng@lprng.com.
You will need to subscribe to the list first before you can post it.
If you have problems compiling the package, you can try these things:
gcc instead of your vendor's C compiler.
CC=gcc ./configure
OR
configure --with-cc=gcc
/usr/local/include
and libraries are in
/usr/local/include
and these paths are not searched or used by the compiler.
This can be fixed by setting the
CPPFLAGS and LDFLAGS environment variables,
or using the
--with-cppopts=
and
--with-ldopts=
configure options.
CPPFLAGS="-I/usr/local/include -I/usr/include/kerberosIV" \
LDFLAGS="-L/usr/local/lib -L/usr/lib/kerberosIV" \
./configure
OR
configure --with-cppopts="-I/usr/local/include -I/usr/include/kerberosIV" \
--with-ldopts="-L/usr/local/lib -L/usr/lib/kerberosIV"
The configure and make steps must be run on
the target host,
especially if the target host has a different version of the operating system.
This is extremely important for SunOS or Solaris,
where
there tend to be changes in the system's include files between
versions
as well as support libraries.
Read the notes for your OS in section System-dependent notes for specific installation help (if any).
The printcap file contains the definitions of print queues
and other information used by LPRng,
and is located in the directory specified by the
configuration ${sysconfdir} value.
If your system does not have an existing printcap file,
then the following is suitable for initial testing and configuration:
# test printcap file
lp:cm=Test Printcap Entry:
:lp=/dev/null
:sd=/usr/spool/lpd/lp
The lpd.conf
is located in the ${sysconfdir} directory
and provides configuration settings for both the LPRng client and server
programs.
During installation the
lpd.conf.template file
is installed in the
${sysconfdir}/lpd.conf.template
and if there is not an existing lpd.conf file
is copied to
${sysconfdir}/lpd.conf
as well.
The lpd.perms
is located in the ${sysconfdir} directory
and is used by the lpd program to determine user permissions
for printing activities.
During installation the
lpd.perms.template file
is installed in the
${sysconfdir}/lpd.perms.template
and if there is not an existing lpd.perms file
is copied to
${sysconfdir}/lpd.perms
as well.
The client programs
lpr,
lpq,
etc. will check for a lpd.conf and printcap
file.
You can relax this requirement by setting
using the configuration option --disable-require_configfile.
If these files are not going to be used,
then simply create empty files to satisfy the program requirements.
The
checkpc
program is used to make sure that
the spool directories and files used by LPRng have the correct permissions
and are in place.
By default,
checkpc will check permissions and report if there are any problems.
You should run this as root.
For example:
% astart > su
#>cd LPRng/src
#>./checkpc
Warning - No configuration file '/usr/local/etc/lpd.conf'
Warning - No lpd only printcap file found in '/usr/local/lpd_printcap'
Warning - ** cannot open '/var/run/lpd.printer' - 'Permission denied'
Warning - bad directory - /var/spool/lpd/lp
Warning - Printer_DYN 'lp' spool dir '/var/spool/lpd/lp' needs fixing
In the above example,
checkpc has discovered that the lpd.conf
file is missing.
This is a serious problem and indicates that the
software was incorrectly installed.
The lpd only printcap message is usually of concern to administrators who wish to use some of LPRng's more exotic configuration options. It is possible to have separate printcap databases for client and server programs. This is useful when printcap files get extremely large and cuts down substantially on system management problems.
The permission denied message for /var/run/lpd.printer is serious,
as the lpd server uses this as a lock file.
The bad directory message about the spool directory is usually caused by wrong permissions or a missing directory.
The checkpc -f (fix) option causes checkpc to take action to rectify errors.
The checkpc -f -V (verbose) option causes the fixup activity to be displayed a well:
% astart > su
h4# checkpc -f -V
LPRng version LPRng-3.6.14
Checking for configuration files '/usr/local/etc/lpd.conf'
found '/usr/local/etc/lpd.conf', mod 0100644
Checking for printcap files '/usr/local/etc/printcap'
found '/usr/local/etc/printcap', mod 0100644
Checking for lpd only printcap files '/usr/local/etc/lpd_printcap'
DaemonUID 1, DaemonGID 1
Using Config file '/usr/local/etc/lpd.conf'
LPD lockfile '/var/run/lpd.printer'
Checking directory: '/var/run'
directory '/var'
directory '/var/run'
checking '/var/run/lpd.printer' file
Printcap Information
lp
:force_localhost
:lp=/var/tmp/lp
:sd=/var/spool/%P
Checking printcap info
Checking printer 'lp'
Checking directory: '/var/spool/lp'
directory '/var'
directory '/var/spool'
directory '/var/spool/lp'
file 'control.lp', zero length file unchanged in 1 hours
file 'status.lp', zero length file unchanged in 1 hours
file 'status', zero length file unchanged in 1 hours
file 'log', zero length file unchanged in 1 hours
file 'acct', zero length file unchanged in 1 hours
checking 'control.lp' file
checking 'status.lp' file
checking 'status' file
cleaning 'status' file, 0K bytes: no truncation
checking 'log' file
cleaning 'log' file, 0K bytes: no truncation
checking 'acct' file
cleaning 'acct' file, 0K bytes: no truncation
As you can see, checkpc can not only print detailed information about your
printing system, but it also fixes up the various problems.
Before running LPRng, you should shut down and remove the existing print spooler and associated client programs. Unfortunately, this process is fairly system dependent, and requires a small amount of system expertise. In addition to these general directions, you should see the System specific notes for your system.
While it appears that this should be done before you install the LPRng print software, in practice it turns out to be easier to do after you have installed it.
On most systems you need only remove or rename executable files, and should not remove and configuration or data files.
This section provides instructions for systems that use the
lpd print services,
such as SunOS,
BSD derived systems,
and Linux based systems.
These systems use an lpd print server,
as does LPRng.
By convention,
most of the executable programs are in the
/usr/bin,
/usr/sbin,
/usr/libexec,
and
/usr/ucb.
At initialization time these systems run
a rc startup script that starts the lpd
print server.
Unfortunately,
this startup script can a single line in a file
or be a small shell script.
You should first locate the startup script as follows.
/etc
directory.
The commands a typical result on a system are shown.
# cd /etc
# find . -type f -exec grep -l lpd {} \; -print
./rc.local
lpd print spooler.
If they do, then simply comment out the line and
one which contains the path to the LPRng print spooler.
# /etc/rc.local
if [ -f /etc/printcap -a -f /usr/libexec/lpd ] ; then
/usr/libexec/lpd ;
fi
--- change this to
if [ -f /etc/printcap -a -f /usr/local/sbin/lpd ] ; then
/usr/local/sbin/lpd ;
fi
printcap file,
then you should either copy this to the location used by LPRng
or make a symbolic link to it.Next we kill the currently running lpd process.
# most BSD Systems
ps -auxw |grep lpd
# Kill it twice
kill (pid of lpd server)
# This should report an error - if not then lpd did not terminate
kill (pid of lpd server)
#
Example:
astart % ps -axuw |grep lpd
papowell 23932 0.0 0.3 224 184 p3 S+ 10:40AM 0:00.01 grep lpd
daemon 17763 0.0 0.2 448 120 ?? IWs 29Mar99 0:01.35 (lpd)
astart % kill 135
astart % kill 135
135: No such process
Next,
you should remove or rename the existing print system executables.
The following example shows how to use the
find utility to track down candidates.
astart# find /usr -type f -name lp\* -print >/tmp/candidates
astart# find /sbin -type f -name lp\* -print >>/tmp/candidates
astart# cat /tmp/candidates
/usr/bin/lpunlock
/usr/bin/lpqall.faces
/usr/bin/lpq <---- old
/usr/bin/lpr <---- old
/usr/bin/lprm <---- old
/usr/bin/lptest
/usr/doc/samba-1.9.18p10/examples/printer-accounting/lp-acct
/usr/man/man1/lpq.1
/usr/man/man1/lpr.1
/usr/man/man1/lprm.1
/usr/man/man1/lptest.1
/usr/man/man4/lp.4
/usr/man/man8/lpc.8
/usr/man/man8/lpd.8
/usr/sbin/lpc <--- old
/usr/sbin/lpd <--- old
/usr/sbin/lpf <--- old
/usr/local/bin/lpc <-- LPRng
/usr/local/bin/lpq <-- LPRng
/usr/local/bin/lpr <-- LPRng
/usr/local/bin/lprm <-- LPRng
/usr/local/sbin/lpd <-- LPRng
astart # mv /usr/bin/lpq /usr/bin/lpq.old
astart # mv /usr/bin/lpr /usr/bin/lpr.old
astart # mv /usr/bin/lprm /usr/bin/lprm.old
astart # mv /usr/sbin/lpc /usr/sbin/lpc.old
astart # mv /usr/sbin/lpd /usr/sbin/lpd.old
astart # mv /usr/sbin/lpf /usr/sbin/lpf.old
...
After all this,
you should now run checkpc -f
(as root) to make sure that the LPRng configuration is present and
correctly set up,
and then start lpd by hand.
You should try to use lpq to see if the spool queues are present
and set up correctly and the system is functional.
# checkpc -f
# lpd
# lpq
Printer: lw4@h2 'Hp : Laserwriter'
Queue: no printable jobs in queue
Status: job 'root@h2+884' removed at 11:27:25.864
Filter_status: done at 11:27:25.766
# lpr /etc/motd
# lpq
Printer: lw4@h2 'Hp : Laserwriter'
Queue: no printable jobs in queue
Status: job 'root@h2+888' removed at 11:27:25.864
Filter_status: done at 11:33:17.020
Finally,
you should reboot your machine and make sure that the lpd
print server starts correctly.
The original SysVR4 and other related systems did not have any support for RFC1179 network printing (Berkeley LPD). Support for this was added by various manufacture specific methods. Unfortunately, there are a wide range of different installation types.
The lpsched process (/usr/lib/lp/lpsched/)
process performs many of the functions of the LPRng and BSD
lpd
server.
On Solaris systems,
it also stats the
lpNet
server that provides network print services.
Unfortunately,
no simple and reliable method of shutting down a running lpsched
process
and the associated network services has been found.
However,
it turns out to be very simple to prevent the services from
being started.
First,
you will need to locate the /etc/rc startup files
that start system services.
During system startup,
a set of shell scripts stored in the /etc/rc.d
directories are executed.
The individual startupfile files are usually links to a
common one in the /etc/init.d directory.
You first need to find the files containing the startup commands.
This is done as shown below:
SUN # cd /
SUN # find . -type f -exec grep -l lpsched {} \; -print >/tmp/files
SUN # cat /tmp/files
/etc/rc0.d/K20lp
/etc/rc2.d/K20lp
/etc/rc2.d/S80lp
/etc/init.d/lp
># ls -l ` cat /tmp/files `
lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc0.d/K20lp -> ../../init.d/lp
lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc2.d/K20lp -> ../../init.d/lp
lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc2.d/S80lp -> ../../init.d/lp
-rwxr--r-- 5 root sys 460 Sep 1 1998 /etc/rcS.d/K39lp
Here is the contents of the typical script file, with the indicated modifications that should be made for testing
#!/sbin/sh
case "$1" in
'start')
[ -f /usr/lib/lpsched ] && /usr/lib/lpsched ;;
'stop' )
[ -f /usr/lib/lpshut ] && /usr/lib/lpshut ;;
*)
echo "Usage: $0 { start | stop }"
exit 1
esac
exit 0
You should stop the lpsched server by using the following:
sh /etc/rd.c/init.d/lp stop
<verb>
<tscreen>
<p>
We next modify the startup by replacing the start and stop entries
as show below.
We will modify these later to start the LPRng <tt/lpd/ server.
<tscreen>
<verb>
#!/sbin/sh
case "$1" in
'start')
# [ -f /usr/lib/lpsched ] && /usr/lib/lpsched ;;
#[ -f /usr/sbin/lpd ] && /usr/sbin/lpd ;;
'stop' )
# [ -f /usr/lib/lpshut ] && /usr/lib/lpshut ;;
#kill -2 `cat /var/run/lpd*` >/dev/null 2>1;
*)
echo "Usage: $0 { start | stop }"
exit 1
esac
exit 0
Next, as for the BSD installation, we will find all of the printing related commands and rename them. You can either rename them one by one, or use the script method shown below. The minimum of the indicated files should be renamed.
SUN # find /usr -type f -name lp\* -print >/etc/printingfiles
SUN # cat /tmp/printingfiles
/usr/bin/lp <---
/usr/bin/lpstat <---
/usr/lib/lp/bin/lp.cat
/usr/lib/lp/bin/lp.set
/usr/lib/lp/bin/lp.tell
/usr/lib/lp/lpNet <---
/usr/lib/lp/lpsched <---
/usr/lib/lp/lpdata <---
/usr/sbin/lpadmin <---
/usr/sbin/lpfilter <---
/usr/sbin/lpforms <---
/usr/sbin/lpmove <---
/usr/sbin/lpshut <---
/usr/sbin/lpsystem <---
/usr/sbin/lpusers <---
/usr/ucb/lpc <---
/usr/ucb/lpq <---
/usr/ucb/lpr <---
/usr/ucb/lprm <---
/usr/ucb/lptest
SUN # for i in ` cat /tmp/printingfiles ` ; do
> mv $i $i.old
> done
Next, you find if there is a cron job scheduled
by the file
/var/spool/cron/crontabs/lp
to periodically update and roll over error logs.
If there is, you should
(after having saved the file)
remove it.
cp /var/spool/cron/crontabs/lp /etc/cron.crontabs.lp
Check the /etc/inetd.conf file for a line like:
printer stream tcp nowait root /usr/lib/print/in.lpd in.lpd
Comment out this line. This line is not present on all systems.
Now we must reboot the machine. You can use
reboot if you are in a rush,
and shutdown if you are not.
SUN # reboot
or
SUN # shutdown -y "Whooga! Whooga! Dive! Dive! System going down."
When the system reboots,
check to make sure that the
lpd server is not listening on port 515.
SUN # telnet localhost 515
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
If you do get a connection established
then you must use nlsadmin to force the
tcpip listener to release the port, as illustrated below.
SUN # nlsadmin -v tcp
lpd \x00020203000000000000000000000000 ENABLED \
NORPC root NOMODULES /var/spool/lp/fifos/listenBSD #
0 \x00020ACE000000000000000000000000 ENABLED \
NORPC root NOMODULES /usr/lib/saf/nlps_server #
lp NOADDR ENABLED NORPC root NOMODULES \
/var/spool/lp/fifos/listenS5 #
SUN # nlsadmin -r lpd tcp
SUN # nlsadmin -r lp tcp
You might also want to run
pmadm -l and if you see anything other than zsmon stuff (e.g. lp
stuff is there), then use pmadm -r to remove it.
See the man page for details.
Once you disable the listener, reboot the system and try to connect to port 515. If you can still do this then there is some other unknown problem beyond these instructions and you should consult Sun Microsystems.
Finally we enable the lpd server.
Edit the startup script as shown below:
#!/sbin/sh
case "$1" in
'start')
# [ -f /usr/lib/lpsched ] && /usr/lib/lpsched ;;
[ -f /usr/sbin/lpd ] && /usr/sbin/lpd ;;
'stop' )
# [ -f /usr/lib/lpshut ] && /usr/lib/lpshut ;;
kill -2 `cat /var/run/lpd*` >/dev/null 2>1;
*)
echo "Usage: $0 { start | stop }"
exit 1
esac
exit 0
Now try starting and stopping the server:
# sh -x /etc/rc.d/init.d/lp start
# lpq
# lpq
Printer: lw4@h2 'Hp : Laserwriter'
Queue: no printable jobs in queue
Status: job 'root@h2+884' removed at 11:27:25.864
Filter_status: done at 11:27:25.766
The following are a series of tests you might need to do if LPRng is installed correctly, but printing does not work.
These tests run lpd executable in the
foreground and test mode,
and are used to make sure that our system configuration is
correct.
It is best to do this with two screens or windows,
as you will want to observe the output.
First,
you need to kill the running lpd process.
The method is left as an exercise for the system administrator.
Next,
you run lpd in forground mode:
# > /usr/local/bin/lpd -F
Fatal error - Another print spooler is using TCP printer port
# > /usr/local/bin/lpd -F -D1
...
1999-04-05-10:02:37.755 astart10 [28903] lpd Read_file_and_split: \
cannot open file '/etc/lpd.perms' - No such file or directory
1999-04-05-10:02:37.758 astart10 [28903] lpd Read_file_and_split: \
cannot open file '/usr/etc/lpd.perms' - No such file or directory
1999-04-05-10:02:37.759 astart10 [28903] lpd Build_printcap_info: \
list->count 0, raw->count 3
1999-04-05-10:02:37.777 astart10 [28903] lpd lpd: listening socket fd -6
Fatal error - Another print spooler is using TCP printer port
1999-04-05-10:02:37.782 astart10 [28903] lpd Get_max_fd: getrlimit returns 64
1999-04-05-10:02:37.783 astart10 [28903] lpd Get_max_fd: returning 64
1999-04-05-10:02:37.786 astart10 [28903] lpd cleanup: done, doing killpg \
then exit(0)
If you get the above error message,
then you have either not killed off other the running lpd server
or you are not starting the lpd server as ROOT.
This is the most common error during setup.
Correct the problem and then restart the server if necessary.
You should see the output indicated below:
# > /usr/local/bin/lpd -F -D1
1999-04-05-14:35:14.023 astart27 [2667] Waiting lpd: LOOP START
1999-04-05-14:35:14.024 astart27 [2667] Waiting Get_max_servers: getrlimit returns 256
1999-04-05-14:35:14.024 astart27 [2667] Waiting Get_max_servers: returning 128
1999-04-05-14:35:14.025 astart27 [2667] Waiting lpd: max_servers 128, active 0
1999-04-05-14:35:14.025 astart27 [2667] Waiting lpd: starting select timeout 'yes', 600 sec
Now from another window do the following commands:
# > lpq -Plp@localhost
Printer: lp@astart
Queue: no printable jobs in queue
# > lpq
Printer: lp@astart
Queue: no printable jobs in queue
At this point your LPRng software has been installed and tested.
You still need to set up
Startup Scripts
to automatically start it at boot time,
and
/etc/printcap
entries for your printers.
Many UNIX utilities in the Solaris and HP UNIX environment use the
UNIX System V lp and lpstat
programs.
It is almost impossible to modify the programs themselves,
as many are vintage software that is unsupported or which would
be too costly to update.
In order to support these applications,
LPRng provides simulation for the
lp,
lpstat,
and
clean
commands.
The LPRng lpstat command is a modified version of the
lpq command,
and accepts the lpstat command line options and tries to return
status in an lpstat format.
If the lpr program is invoked with the name lp,
it will simulate the lp options.
Finally, if the lprm program is invoked with the name cancel,
it will simulate the lp options.
This can be done by using symbolic links or copying the programs.
Note that many of the vintage applications have fully qualified
paths to the lp and lpstat executables,
so it will be necessary to copy them to the
execution directory or make symbolic links from the
directories to the programs. In the example below
the executables are assumed to be installed in the
/usr/local/bin directory:
# original - /usr/bin/lp
# original - /usr/bin/lpstat
cd /usr/local/bin
cp lpr /usr/bin/lp
cp lpstat /usr/bin/lpstat
cp lprm /usr/bin/cancel
OR
cd /usr/bin
ln -s /usr/local/bin/lpr lp
cp /usr/local/bin/lpstat .
ln -s /usr/local/bin/lprm cancel
See the man pages for lp, lpstat, and cancel in the LPRng/man directory. Not all the functions of the original programs are supported and these man pages should be installed to replace the original lp, etc, man pages.
The SMB network protocol
is used by many Microsoft Operatings Systems
to implement file and printer sharing.
SAMBA is a UNIX package that implements the SMB protocol and provides
a simple and easy way to import and export file systems and printer
facilities.
The web site for SAMBA is
http://www.samba.org.
The SAMBA code is extremely easy to install
and the SWAT (Samba Web Administration Tool)
makes configuruation almost trivial.
The
See the SAMBA
doc/text/Printing.txt and related documentation for details on
printing.
In the
samba.conf file [global] section
or in the SWAT page for printing configuration
you need to specify the that you want to have
Samba handle printing,
the
print, lpq, and lprm commands to be used when a user
prints a job,
asks for status,
or removes a job,
and a temporary directory to hold print jobs when they are submitted.
[printers]
path = /usr/spool/lpd/samba
# --- do not use the Samba default path = /tmp
guest ok = no
print ok = yes
printing = lprng
load printers = yes
printcap name = /etc/printcap
print command = /usr/local/bin/lpr -P%p -r %s
lpq command = /usr/local/bin/lpq -P%p
lprm command = /usr/local/bin/lprm -P%p %j
lppause command = lpc hold %p %j
lpresume command = lpc release %p %j
queuepause command = lpc -P%p stop
queueresume command = lpc -P%p start
#
# alternative to allow userid to be specified as well
#
# You will have to add the samba UID to the 'allow_user_setting'
# option in the /etc/lpd.conf file.
# WARNING: the %U is the name the user requests. If you have
# 'guest' printer use, then you should be aware that this
# will allow anybody to impersonate a another user, and they will
# be able to execute the various LPRng commands as that user.
#
# print command = /usr/local/bin/lpr -U%U -P%p -r %s
# lprm command = /usr/local/bin/lprm -P%p -U%U %j
# lppause command = lpc -U%U hold %p %j
# lpresume command = lpc -U%U release %p %j
# queuepause command = lpc -U%U -P%p stop
# queueresume command = lpc -U%U -P%p start
Please use the following guidelines in your setup.
printing = lprng.
In newer versions of Samba this will allow Samba to use the
LPRng printcap file.printcap file.
In later versions of Samba you can use the following printcap entry
to specify the printers.
In fact, this can be the only
entry in the printcap file if you are using lightweight print clients.
all:all=pr1,pr2,pr3,...
lpr -U%U option shown in the example above is part of
LPRng's support for Samba.
This causes the lpr and other clients to use the user name specified
with the -U option
as the originator of the command,
instead of the userid that Samba is operating with.
This makes jobs appear to be spooled by the user
and commands appear to originate with the user.
See the
allow_user_setting
configuration option for details.path option.
This should NOT be the tmp directory,
but should be in a file system able to handle extremely large print files.
For example,
if your LPRng spool queue directory is /var/spool/lpd,
then a good location would be /var/spool/lpd/samba.While the LPRng software has been written with security as the primary goal there is always the problem with undetected errors in the LPRng software that when exploited could cause severe system problems. The most serious concern is that of gaining ROOT (UID 0) permissions.
One way to avoid this is to run client programs without root permission. This operation is possible for LPRng in contrast to other print spooling software.
A serious concern when LPRng runs as a nonprivileged
user (daemon) is the fact that the RFC protocol specifies
that connections are made to port 515
and
lpd
requires root permissions to open and bind to port 515.
One option is to have the lpd server drop root permissions
soon after binding to this port and before accepting any user
commands.
However,
in order to fully compatible with RFC1179,
lpd must originate connections from a reserved
port in the range 721-731,
although in practice port 1-1023 seems to be acceptable.
If inter-operability with non-LPRng print spoolers is not desired,
then it is trivial
to configure LPRng using the lpd.conf
file or by modifying the compile time
lpd_port
value in the file or the LPRng/src/vars.c
so that all the software will run
as client programs.
For example,
in the /etc/lpd.conf file,
you only need to change the indicated lines:
# Purpose: lpd port
# default lpd_port=printer
lpd_port=2000
Now all the LPRng software will use port 2000 to transfer jobs and commands. You can also use this facility to establish a private set of print spoolers which can be used for testing.