[samba] windows client use Linux printer

Joel Hammer Joel at HammersHome.com
Tue Feb 18 22:24:01 GMT 2003


This is always a tricky situation. There is nothing simple about printing.
It may look simple, but it is not.  So, to get it done, I keep it as
simple as possible.

Basics:
The windows client transfers the job, prefiltered, to the spool directory
listed in the samba print share. Then, the command you have supplied in the
samba print share is invoked to print that file. The file name is %s.
Now, things are hard to follow when you get fancy and use (perhaps
unknowingly) a bunch of default settings which may not be what you need.
Attempting to load the drivers onto you samba server to allow easy
configuration on the windows clients is also another source of error.

Now, a basic question is this: Can you print from the samba server directly
to your printer? lexmark does provide some nice drivers for their printers
for linux, but other drivers might be available. Anyway, if you have a
driver for your lexmark printer that works in linux, that means you can
convert postscript files to a format your printer understands. If so, you
can just use a generic postscript driver on your windows client. HP Laserjet
III + works fine for me. Then, direct your printjobs to the queue that does
all your other printing on the linux server, and the problem is solved.

Here is what I have in my set up:

This is /etc/printcap

ps|z53:\
        sh:sd=/var/spool/lpd/z53:mx#0:\
        :lp=/dev/lp0:\
        :if=/usr/local/lexmark/z53/z53.sh  
        :mc#1
        :sh:

lp|LP|z53-outfiles:\
	:sd=/var/spool/lpd/lp:\
	:mx#0:\
	:lp=/dev/lp0:\
	:sh:rw:

The first handles postscript jobs, the second handles jobs that are
already filtered for this printer, ie, a raw queue. This raw queue is
there to print test pages from the linux server, too. If you filter
your jobs on your clients with the lexmark driver, you would use queue #2
(lp). If you send postscript jobs, you would use #1 (ps).  Notice there
is no "if" parameter in the raw queue.

Here is my printer share definitions. I don't use the special printer share,
because I don't have dozens of printer to service, and I want to be sure I
know what samba is really trying to do.
smb.conf:

[lp]
	comment = Raw Printer for Z53
	path = /tmp
	create mask = 0700
	guest ok = yes
	hosts allow = 192.168.
	printable = Yes
	printing = lprng
 	print command = echo %J %p %s  >>  /tmp/junkJ;\
                       a="`echo '%J' | sed "s/^.*- //"`" ;\
	               echo This is truncated $a >> /tmp/junkJ;\
                       /usr/bin/lpr -Plp  -J"$a"  %s;\
                       rm %s
	lpq command = /usr/bin/lpq -Plp
	lprm command = /usr/bin/lprm -Plp %j
	lppause command = /usr/sbin/lpc hold -Plp %j
	lpresume command = /usr/sbin/lpc release -Plp %j
	printer name = lp
	share modes = No

[ps]
	comment = Filtered for Z53
	path = /tmp
	read only = No
	create mask = 0700
	guest ok = yes
	hosts allow = 192.168.
	printable = Yes
	printing = lprng
 	print command = echo %J %p %s  >>  /tmp/junkJ;\
                       a="`echo '%J' | sed "s/^.*- //"`" ;\
	               echo This is truncated $a >> /tmp/junkJ;\
                       /usr/bin/lpr -Pps  -J"$a"  %s;\
                       rm %s
	lpq command = /usr/bin/lpq -Pps
	lprm command = /usr/bin/lprm -Pps %j
	lppause command = /usr/sbin/lpc hold ps %j
	lpresume command = /usr/sbin/lpc release ps %j
	share modes = No
        use client driver = yes     

Notice I state the printing system in each share, and explicitly
state all commands which might be encountered. (Samba uses BSD as
the default.) Actually, samba understands a few more commands than
this. strings `which smbd` | grep command is interesting.  When you
realize that you can customize each of these commands, things start
getting interesting. My print command is a bear, but it simply captures
the banner page title, which is the file name in windows, and removes
unnecessary garbage so your queue name looks nice (lpq) and is meaningful.

Assuming that the ps queue can handle postscript files, if you just
configure the ps share here on your windows client with the HP postscript
driver, all should go well.

Joel


On Tue, Feb 18, 2003 at 08:38:49PM +0200, David Harel wrote:
> Hi,
> 
> Well, my previous attempt to get info on that matter was lame and 
> therefore no one replied. Here is a second attempt.
> 
> I need info about how to configure samba server and the windows (2000) 
> client to use a printer on the samba server machine.
> 
> I read the article: 
> http://de.samba.org/samba/ftp/docs/htmldocs/Samba-HOWTO-Collection.html#AEN833
> but all I got from it was confusion. I need a simple step by step 
> explanation.
> 
> By the way, you can review details of my attempt on the message I posted 
> a few days ago to this same list titled:
> [samba] Help request setting w2000 to use Lexmark z25 printer on Linux 
> RH7.3 running samba.
> 
> -- 
> Thanks for your effort and good will.
> 
> David Harel,
> 
> ==================================
> 
> Home office +972 4 6921986
> Fax:        +972 4 6921986
> Cellular:   +972 54 534502
> Snail Mail: Amuka
>             D.N Merom Hagalil
>             13802
>             Israel
> Email:      harel at ergolight-sw.com
> 
> 
> 
> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  http://lists.samba.org/mailman/listinfo/samba


More information about the samba mailing list