Recipe 14.3. Serving Linux Clients
14.3.1 Problem
You want to share the printers
attached to your Linux PCs with other Linux clients on your LAN.
14.3.2 Solution
First, make sure CUPS is installed on all the computers with attached
printers. These PCs must have static IP addresses and
you'll need name resolution in place and working
(/etc/hosts or a local DNS server).
Next, on the PCs with printers attached, edit
/etc/cupsd.conf. This sample
cupsd.conf shows how to make the printers
accessible to the local subnet. You can use this as
it's shown, using your own network values:
LogLevel info
Port 631
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.1.*
</Location>
BrowseAddress 192.168.1.255
Add this entry to restrict administrative access to the server only
and not allow it from client machines:
<Location /admin>
AuthType Basic
AuthClass System
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>
Restart cupsd after editing
cupsd.conf:
# /etc/init.d/cupsys restart
On Red Hat and Fedora, use:
# /sbin/service cups restart
Print a test page. If you get the infamous
"client-error-not-found" message,
stop and restart the printer from the CUPS web interface.
CUPS printers will now automatically broadcast themselves on the
network. Make sure that TCP port 631 is not blocked on either the
server or the client machines.
Open the CUPS web interface
(http://localhost:631/documentation.html) on
any of the Linux client PCs, and all CUPS printers should
automatically appear on the Printers page. You can now print a test
page and print from applications.
14.3.3 Discussion
If there is a sample cupsd.conf on your system,
don't let its size scare you. Chances are
you'll never need most of the directives; just hang
on to it as a reference, and create your own
cupsd.conf from scratch.
All of the directives in cupsd.conf are listed
and defined in the CUPS Software Administrators
Manual, at
http://localhost:631/documentation.html.
- LogLevel info
-
There are 10 levels of logging. info is the
default; it logs errors and printer activity in
/var/log/cups/error_log.
- Port 631
-
This is reserved for IPP (Internet Printing Protocol).
- <Location /></Location>
-
The Location directive specifies access control
and authentication options. Note the positioning of the
slashes—make sure you get them right, or things
won't work.
- Order Deny,AllowDeny From AllAllow From 127.0.0.1Allow From 192.168.1.*
-
Your standard "deny all, allow as
needed" scheme, limiting inbound connections to the
local machine and the local subnet.
14.3.4 See Also
|