Best Printer Setup

Lazarus Long lazarus.long at bigfoot.com
Wed Apr 21 17:20:32 GMT 1999


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Date: Tue, 6 Apr 1999 9:06:54 EDT
> From: Rich_Jones at wmg.com
> To: <samba at anu.edu.au>
> Subject: Best Printer Setup
> Message-ID: <vines.Hyc7+iPU0rA at corp.wmg.com>
> 
> Hi,
> 
> 	I've been toying with the idea of using the Linux machine as a
print
> 	
> server.  I'm using RedHat 5.2 and Samba 2.0.3.  I already have one
> remote 
> printer share working...  but I can't figure out where the PrintTool

...

> 	The network printers here use a pocket print server that is being 
> flashed to use TCPIP.  They will now have an IP address assigned to
> them 
> (they were previously configed for Vines).  I was looking at a
> printcap 
> example and saw the rp=raw and rm=IPAddress options added.  I am
> assuming 
> that the rm is the remote printers IP address and it wants the data
as
> raw.
> 
> 	Any ideas or examples would greatly be appreciated.

No ideas, no special thoughts, just our configuration.

Yes, you are half right. The "rm=" field is a remote machine (either
IP quad dotted or DNS), the "rp=" field is the remote printer lpd
queue.

What happens is that if you have a Windows machine (or a Macintosh for
that matter) configured with the correct drivers for the printer you
are using you can normally get away with the "rp=raw" entry or even
with no "rp=" entry at all. If you are printing to such a printer from
your Linux box and you are using a text file you will probably get the
staircase effect (in this case either use a filter, try "pr file.txt
|lpr -Pprinter" or in some cases you can try to set another entry with
the same settings as the "raw" entry but with "rp=text" and of course
change the queue name).

O.K., that is enough for introduction. Our network layout:

One HP JetDirect 500X (print server) with one HP LaserJet 4P, one
DeskJet 870Cxi and one dot matrix printer, one HP LaserJet 5MP with
internal ethernet interface, one HP JetDirect 500X with a HP LaserJet
6MP and a DeskJet 560C, one Linux box server (Intel architecture)
about 20 PC (seven on one subnet) and half a dozen Macintoshes. All
this is on a Veterinary School and Hospital.

PC's are running mainly Windows 98, some Windows 95, one OS/2, NT
Workstation SP4 and RedHat 5.2 (it's mine and I multi-boot it with NT,
OS/2, W98, RH 5.2 and BeOS 3.2 just for testing, it isn´t a work box)
and one Windows 3.11. Mac's are running MacOS since 7.1PO-2 to 8.1.
The Linux server is running Debian 2.1, SAMBA 1.9.18p10 and
Netatalk+sun 4.12.

The net topology has seven PC and one print server on one subnet and
the remaining computers and printers on another. The Linux server is
on both nets.

Before going on let me say that the configuration we are using isn't
really needed since all print servers can work stand alone. We are
using it this way mainly for accounting and permission reasons.

Files to look at:

1. /etc/printcap

2. /etc/smb.conf (it may be /etc/samba/smb.conf) for PC's.

3. /etc/netatalk/papd.conf (it may be /etc/atalk/papd.conf or even
/etc/papd.conf) for Mac's (I could have set up the NetBIOS client DAVE
but it isn't freeware, it's slower and where's the fun of it?).

1. Our /etc/printcap:

# start of /etc/printcap

# Veterinary Hospital subnet.
# 7 clients one JetDirect with 3 printers.

# JetDirect 500X
# Port 1 (TCP 9100) LaserJet 4P (this is the JetDirect
# PCL port so we need LaserJet here).
lj4p|lp1:\
	:sd=/var/spool/lpd/lj4p:\
	:mx#0:\
	:rm=192.168.1.200:\
	:sh:\
	:lf=/var/spool/lpd/lj4p/log:\
	:af=/var/spool/lpd/lj4p/acct:\
	:rp=raw:
#	:rp=raw1:\	# Either these
#	:rp=:\		# can work also
#	:if=/var/spool/lpd/lj4p/filter: # Not needed, not printing from
#								Linux

# Port 2 (TCP 9101) DeskJet 870Cxi
dj870cxi|lp2:\
	:sd=/var/spool/lpd/dj870cxi:\
	:mx#0:\
	:rm=192.168.1.200:\
	:lf=/var/spool/lpd/dj870cxi/log:\
	:af=/var/spool/lpd/dj870cxi/acct:\
	:sh:\
	:rp=raw2:
#	:if=/var/spool/lpd/dj870cxi/filter: # Not needed, not printing from
#									Linux

# Port 3 (TCP 9102) dot-matrix
dot-matrix|lp3:\
	:sd=/var/spool/lpd/dot-matrix:\
	:mx#0:\
	:rm=192.168.1.200:\
	:lf=/var/spool/lpd/dot-matrix/log:\
	:af=/var/spool/lpd/dot-matrix/acct:\
	:sh:\
	:rp=text3:
#	:if=/var/spool/lpd/dot-matrix/filter: # Not needed, not printing
#									  from Linux

# Veterinary School subnet.
# 21 clients, one JetDirect with 2 printers, one internal JetDrect.

# LaserJet 5MP.
lj5mp|lp:\
	:sd=/var/spool/lpd/lj5mp:\
	:mx#0:\
	:rm=192.168.2.200:\
	:lf=/var/spool/lpd/lj5mp/log:\
	:af=/var/spool/lpd/lj5mp/acct:\
	:sh:\
	:rp=:
#	:rp=raw:\		# Either these
#	:rp=raw1:\	# can work also
#	:if=/var/spool/lpd/lj5mp/filter: # Not needed, not printing from
#								  Linux

# JetDirect 500X
# Port 1 (TCP 9100) LaserJet 6MP (this is the JetDirect
# PCL port so we need LaserJet here).
lj6mp|lp4:\
	:sd=/var/spool/lpd/lj6mp:\
	:mx#0:\
	:rm=192.168.2.201:\
	:lf=/var/spool/lpd/lj6mp/log:\
	:af=/var/spool/lpd/lj6mp/acct:\
	:sh:\
	:rp=raw:
#	:rp=raw1:\	# Either these
#	:rp=:\		# can work also
#	:if=/var/spool/lpd/lj6mp/filter: # Not needed, not printing from
#								  Linux

# Port 2 (TCP 9101) DeskJet 560C
dj560c|lp5:\
	:sd=/var/spool/lpd/dj560c:\
	:mx#0:\
	:rm=192.168.2.201:\
	:lf=/var/spool/lpd/dj560c/log:\
	:af=/var/spool/lpd/dj560c/acct:\
	:sh:\
	:rp=raw2:
#	:if=/var/spool/lpd/dj560c/filter: # Not needed, not printing from
#								  Linux

# Recursive call for DeskJet 560C for use with netatalk
# This entry is highly dependent on the filter, since it
# must preprocess the input and feed it to the above 
# dj560c entry with a call like "|lpr -Pdj560c"
dj560c-ps:\
	:lp=/var/spool/lpd/dj560c-ps/null:\
	:sd=/var/spool/lpd/dj560c-ps:\
	:mx#0:\
	:sh:\
	:if=/var/spool/lpd/dj560c-ps/aps-cdj550-a4-auto-color:
# The above filter was created with the apsfilter
# package, it was edited and uncommented the line
# "REMOTE_PRINTER=True" and changed the line resulting
# by issuing "grep -n -e -Premote aps-cdj550-a4-auto-color"
# to read 'PRINT_PS="$PRINT_PS | lpr -Pdj560c"'

# end of /etc/printcap


2. Our /etc/smb.conf:

# start of /etc/smb.conf

;==================== Global Settings ====================
[global]
	admin users = amr
	case sensitive = no
	character set = iso8859-1
	debug level = 3
	dns proxy = no
	encrypt passwords = yes
	interfaces = 192.168.2.1/24 192.168.1.1/24
	invalid users = root
	lock directory = /var/samba
	locking = yes
	log file = /var/log/samba/%m.log
	max log size = 1024
	message command = /bin/mail -n -s 'WinPopup message to %t from %f on
%m' amr root < %s; /bin/rm -f %s &
	netbios aliases = hospital
	netbios name = school
	passwd chat = *New\spassword:* %n\n *Re-enter\snew\spassword:* %n\n
*Password\schanged.* .
	passwd program = /usr/bin/passwd %u
	preserve case = yes
	remote announce = 192.168.2.255 192.168.1.255
	security = share
	short preserve case = yes
	socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=4096
SO_RCVBUF=4096
	strip dot = yes
	syslog = 3
	unix password sync = yes
	wide links = no
	wins support = yes
	workgroup = Veterinary

	printing = bsd
	printcap name = /etc/printcap
	load printers = no
; Inspite what is recomended we are NOT loading all printers
; automatically we are limiting access to printers according
; to subnet masks and this is the way we got it running.

	domain master = yes
	local master = yes
	preferred master = yes
	os level = 65

;================== Share Declarations ====================

; ... we are also sharing files but it isn't important

[lj4p]
	allow hosts = 192.168.1.
	browseable = no
	comment = HP LaserJet 4P Printer
	create mask = 0700
	force group = samba
	force user = rlp
	guest account = rlp
	guest only = yes
; Don't forget to create user rlp in group samba for it to work
	path = /home/samba/spool
	printable = yes
	printer = lj4p
	printer driver = HP LaserJet 4P
	public = yes
	writable = no

[dj870cxi]
	allow hosts = 192.168.1.
	browseable = no
	comment = HP DeskJet 870Cxi Printer
	create mask = 0700
	force group = samba
	force user = rlp
	guest account = rlp
	guest only = yes
; Don't forget to create user rlp in group samba for it to work
	path = /home/samba/spool
	printable = yes
	printer = dj870cxi
	printer driver = HP DeskJet 870Cxi
	public = yes
	writable = no

[matrix]
	allow hosts = 192.168.1.
	browseable = no
	comment = Generic Printer
	create mask = 0700
	force group = samba
	force user = rlp
	guest account = rlp
	guest only = yes
; Don't forget to create user rlp in group samba for it to work
	printable = yes
	printer = dot-matrix
	public = yes
	writable = no

[lj5mp]
	allow hosts = 192.168.2.0/24 EXCEPT 192.168.2.254
; 192.168.2.254 is our Internet Gateway so no access frow outer world
	browseable = no
	comment = HP LaserJet 5MP Printer
	create mask = 0700
	force group = samba
	force user = rlp
	guest account = rlp
	guest only = yes
; Don't forget to create user rlp in group samba for it to work
	path = /home/samba/spool
	printable = yes
	printer = lj5mp
	printer driver = HP LaserJet 5MP
	public = yes
	writable = no

[lj6mp]
	allow hosts = 192.168.2.0/24 EXCEPT 192.168.2.254
; 192.168.2.254 is our Internet Gateway so no access frow outer world
	browseable = no
	comment = HP LaserJet 6MP Printer
	create mask = 0700
	force group = samba
	force user = rlp
	guest account = rlp
	guest only = yes
; Don't forget to create user rlp in group samba for it to work
	path = /home/samba/spool
	printable = yes
	printer = lj6mp
	printer driver = HP LaserJet 6MP
	public = yes
	writable = no

[dj560c]
	allow hosts = 192.168.2.0/24 EXCEPT 192.168.2.254
; 192.168.2.254 is our Internet Gateway so no access frow outer world
	browseable = no
	comment = HP DeskJet 560C Printer
	create mask = 0700
	force group = samba
	force user = rlp
	guest account = rlp
	guest only = yes
; Don't forget to create user rlp in group samba for it to work
	path = /home/school/spool
	printable = yes
	printer = dj560c
	printer driver = HP DeskJet 560C Printer
	public = yes
	writable = no

# end of /etc/smb.conf


3. Our /etc/netatalk/papd.conf:

# start of /etc/netatalk/papd.conf

HP DeskJet 560C:\
	:lp=dj560c-ps:\
	:op=rlp:\
	:pd=/var/spool/lpd/dj560c-ps/APPLE230.PPD:

# end of /etc/netatalk/papd.conf


o Now to create the corresponding spooler entries et al:

- - First one must create the directories under the /var/spool/lpd tree.
- - Second one has to create the acct and log files in each directory
(try "touch acct" and "touch log").
- - Third we must create the print filter (have a look at apsfilter).
- - Fourth, in case we are setting a print server for Mac's also, we
must get the PPD file corresponding to our printer (use APPLE230.PPD
for non PostScript printers) from the printer vendor or from
ftp.adobe.com.
- - Fifth, and also regarding the NETATALK suite we must create the null
device (use "mknod /var/spool/lpd/dj560c-ps/null c 3 1"). It is a
common mistake to use /dev/null since the lp deamon locks exclusivelly
the printer device and any other process accessing /dev/null will die
and or hang the system.
- - Next we must change the ownership of the print spooler files (try
"chown -R root.lp /var/spool/lpd/*").
- - Finally we must change the permissions for the files (maybe "chmod
660" for all and "chmod 770" for the print filter).
Now we start the print spooler (run "/etc/init.d/lpd restart" or maybe
"/etc/rc.d/init.d/lpd restart").


o Second step is to setup the SAMBA space:

We have created a user named rlp belonging to group samba for
accounting purposes.

- - First create the SAMBA spooler directory (try "mkdir -p
/home/samba/spool").
- - Second change the ownership of the directory (run "chown rlp.samba
/home/samba/spool")
- - Now we reload the SAMBA server (run "/etc/init.d/samba restart" or
maybe "/etc/rc.d/init.d/smb reload")


o Final step is to setup the NETATALK print deamon:

- - With the above steps done and a well configured
/etc/netatalk/atalkd.conf (it may be also located in the /etc/ or
/etc/atalk/ directories) we just have to reload it with
"/etc/init.d/netatalk restart" or maybe "/etc/rc.d/init.d/atalk
restart".


Just one final consideration. Although we have computers and printers
living in two diferent subnets and we maintained them in that manner
in our configuration, since we are passing all print jobs through our
Linux server which is on both subnets, we could easilly allow printing
to any printer regardless of which subnet it is on (this isn't
possible without the server spooling print jobs since we don't have
routes between the subnets).

Hope this example helps you in any way.

- ---
Lazarus Long
<lazarus.long at bigfoot.com>
PGP:
<http://wwwkeys.pgp.net:11371/pks/lookup?op=index&search=0x5C1DC205>
ICQ#: 30062012

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.0.2i

iQA/AwUBNx4I4Al0Rr1cHcIFEQKHJwCfaPjyjk/rUjQfHY5L1ua+nTAjlosAmgIu
T+th4ZSff9fCvDHjNPTwLufn
=uAS6
-----END PGP SIGNATURE-----



More information about the samba mailing list