[cups.general] Need help with cups backend smb

Stefano Ansoldi stefano.ansoldi at gmail.com
Sun Sep 9 09:30:05 PDT 2012


Scott Carradice <scott at ...> writes:

> 
> I have set up samba and it seems to be working properly. The following command 
works well for me:
> 
> smbspool "smb://user:pass <at> computer/printerone" 30 1 1 1 1 
testprintfile.prn
> 
> testprintfile.prn is a file I made under windows with the print to file 
option.
> 
> I have set up a printer with the webmin utility for cups.  The files do not 
print and I look at the output of "ps xa
> | grep smb" and get:
> 
> 2063 ?        S      0:00 smbd -D
>  2886 ?        S      0:00 smb://user:pass <at> computer/printerone 24 root 
498261_1_test_print.cgi 1  /var/spool/cups/d00024-001
> 
> It looks to me cups is not passing enough arguments to the smbspool program.  
There should be one more element
> after the "1".  Job number is 24, user is root, title is 
498261_1_test_print.cgi copies are 1.  Now if in my
> testing of smbspool I do no put anything in the options position it just seems 
to hang just before 
> it should print.  
> 
> I am using using the "HP LaserJet Series CUPS v1.1" driver for the printer 
which is a hp laserjet 1000 without
> any ps options.
> 
> Any help in getting this working would be much appreciated.
> 
> Scott
> 
> P.S. following are printer.conf and error logs.
> 
> Printer.conf:
> 
> [OMITTED IN REPLY]
> 
> This is the errorlog:
> 
> [OMITTED IN REPLY]> 

Dear Scott,

I had exactly the same problem... which I would have never solved without your
post! Also in my version of Linux (Ubuntu 10.04 LTS) one parameter is missing
when CUPS calls smbspool through the smb backed. Then smbspool thinks the file
to be printed is missing and waits for it until the print job 
is cancelled.

I solved the problem following the instructions in this link

http://willem.engen.nl/projects/cupssmb/

in the section "A CUPS backend using smbclient".

Basically you can create another backend (called, for instance, smbc) using the
shell script reported below. The script uses smbclient to submit the print job
to the samba server: credentials (if required) can be set up in a separate file
(following, for example, the instructions in the link above,
"/etc/samba/printing.auth" *note* in my case I did not have to change the
ownership of the file [root,root] and I made it readable by the owner [root]
only).

You can then reconfigure the printer by using smbc as a backend instead than
smb (so you will end up with something like "smbc://computer/printerone").

Best,

Stefano

---------- smbc - taken from http://willem.engen.nl/projects/cupssmb/ ---------

#!/bin/sh

if [ "$1" = "" ]; then
	# list supported output types
	echo 'network smbc "Unknown" "Windows Printer using smbclient"'
	exit 0
fi

job="$1"
account="$2"
title="$3"
numcopies="$4"
options="$5"
filename="$6"

if [ "$filename" = "" ]; then
	filename=-
fi

# strip protocol from printer
printer=`echo "${DEVICE_URI}" | sed 's/^.*://'`

# and print using smbclient
echo "NOTICE: smbclient -N -A /etc/samba/printing.auth -c \"print ${filename}\" 
\"${printer}\"" 1>&2

errtxt=`smbclient -N -A /etc/samba/printing.auth -c "print ${filename}" 
"${printer}" 2>&1`
ret=${?}


#
# Handle errors
#   see backend(7) for error codes

# log message
if [ "$ret" = "0" ]; then
	echo "$errtxt" | sed 's/^/NOTICE: /' 1>&2
else
	echo "$errtxt" | sed 's/^/ERROR: /' 1>&2
fi

# "NT_STATUS_LOGON_FAILURE" -> CUPS_BACKEND_AUTH_REQUIRED
echo "$errtxt" | grep -i 'LOGON_FAILURE' >/dev/null && return 2
# "Unable to open credentials file!" -> CUPS_BACKEND_AUTH_REQUIRED
echo "$errtxt" | grep -i 'credentials' >/dev/null && return 2
# "NT_STATUS_BAD_NETWORK_NAME" -> CUPS_BACKEND_STOP
echo "$errtxt" | grep -i 'BAD_NETWORK_NAME' >/dev/null && return 4

# something went wrong, don't know what -> CUPS_BACKEND_FAILED
[ "$ret" != "0" ] && return 1

# success! -> CUPS_BACKEND_OK
return 0

==========================






More information about the cups mailing list