Printing with samba + lpr

Thomas Novin tn at alumni.com
Wed Aug 25 20:38:19 GMT 1999


Hi.

After hours and hours of problems I finally got my
HP LaserJet IIIp to print via my samba server. The only
problem that remains is that lpr (or lpq perhaps?) doesn't
clean up in /tmp after printing. I've tried to find the
problem by debugging smbd with strace (with -f) to find
out what really happens. This is the only "error" i found
when searching after 'lpq.00113ec7' in my strace.out.

chmod("/tmp/lpq.00113ec7", 0666)        = -1 EPERM (Operation not permitted)

I couldn't locate any attempts to remove it so I really don't
know what's wrong since there aren't any parameters that
I have forgotten to pass along with lpq (like -r for remove or
something alike). Here follows my smb.conf, printcap & filter
files. Also I would like to know if it would be safe for me to
remove the raw section from my printcap?

Thomas.

--

[ /usr/local/samba/lib/smb.conf ]

[global]

workgroup = PIPE

server string = gate.pipe.org
netbios name = gate

hosts allow = 192.168.1. 127.0.0.1
interfaces = 192.168.1.1/24

; log file = /usr/local/samba/var/log.samba
; max log size = 1024

; debug level = 3

; syslog = 3
; syslog only = no

security = share
encrypt passwords = yes
min passwd length = 3
smb passwd file = /usr/local/samba/private/smbpasswd
username map = /usr/local/samba/private/users.map
guest account = guest

socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=32768 SO_RCVBUF=32768

deadtime = 720
oplocks = yes
read size = 16384
max xmit = 16384
read raw = yes
write raw = yes
getwd cache = yes

null passwords = yes

local master = yes
os level = 40
announce as = NT Server
domain master = yes
preferred master = yes

; wins server = 192.168.1.5

; domain logons = yes
; logon path = \\%L\profile\%U
; logon script = script.bat

load printers = yes
printcap name = /etc/printcap
print command = /usr/bin/lpr -r -b -P%p %s
lpq command = /usr/bin/lpq -P%p
lprm command = /usr/bin/lprm -P%p %j
printer driver file = /usr/local/samba/printer/printer.def

default case = lower
case sensitive = no
preserve case  = no
delete readonly = yes
valid chars = 0345:0305 0366:0326 0344:0304

; [netlogon]
;   comment = network logon service
;   path = /home/samba/netlogon
;   browsable = no
;   readable = yes
;   share modes = no
;   guest ok = yes

; [profiles]
;    path = /home/samba/profiles
;    browseable = no
;    readable = yes
;    guest ok = yes

; [home]
;   path = /home/samba/profiles/%U
;   comment = home directories
;   guest ok = no
;   public = no
;   browsable = no
;   writeable = yes

[ext2]
    comment = ext2 on gate.pipe.org
    valid users = samba
    path = /
    public = no
    browseable = yes
    writeable = yes
    guest ok = no

[cdrom]
    comment = cdrom on gate.pipe.org
    path = /cdrom
    public = yes
    browseable = yes
    writeable = no
    guest ok = yes

[hdc1]
    comment = hdc1 on gate.pipe.org
    valid users = samba
    path = /mnt/hdc1
    public = no
    browseable = yes
    writable = yes
    guest ok = no

[hda3]
    comment = hda3 on gate.pipe.org
    valid users = samba
    path = /mnt/hda3
    public = no
    browseable = yes
    writeable = yes
    guest ok = no

[printer$]
   path = /usr/local/samba/printer
   valid users = samba
   public = no
   writable = no
   browseable = no

[lp]
   comment = HP LaserJet IIIp
   path = /var/spool/lpd/laserjet
   valid users = samba
   browseable = yes
   printable = yes
   public = no
   writable = no
   create mode = 0700
   printer driver = HP LaserJet IIIp
   printer driver location = \\%h\PRINTER$

--

[ /etc/printcap ]

# raw thingy

raw:\
   :rw:sh: \
   :lp=/dev/lp0: \
   :sd=/var/spool/lpd/raw: \
   :fx=flp:

# hp lasjerjet 3p

lp|laserjet|HP LaserJet IIIp:\
   :of=/var/spool/lpd/laserjet/filter:\
   :lp=/dev/lp0:\
   :sd=/var/spool/lpd/laserjet:\
   :fc#0777:\
   :fs#06021:\
   :lf=/var/spool/lpd/laserjet/error:\
   :pl#60:\
   :mx#0:\
   :sb:\
   :sf:\
   :sh:\
   :xc#07737:\
   :xs#040:

--

[ /var/spool/lpd/laserjet/filter ]

#!/bin/bash -f

# This is the output filter for use wth HP LaserJet I, III and III.
# It is called via the of entry in the generic_hp printcap entry.
# All that it does is send the escape sequence to the printer, so that:
#
# CR is mapper to CR
# LF is mapped to CR LF
# FF is mapped to CR FF
#
# and the first two lines reset the printer before each printing
#
# Observe, you must replace every instance of '^[' with "real"
# escape sequences. You create them with c-Q [ESC].

/bin/echo -n '^[E'
/usr/bin/sleep 1
/bin/echo -n '^[&k2G'
/bin/cat
/bin/echo -n '^[&l0H'
if ($status == 0) then
   exit 0
else
   exit 1
endif

--


Thomas Novin · tn at alumni.com · hem3.passagen.se/tnovin
PGP Fingerprint: (Currently Unavailiable)
Certified Linux Administrator (CLA)


More information about the samba mailing list