Technical article 126741

I can't print from a SCO Unix box running Samba 3.0.X to a Windows XP shared printer.

OpenServer 6.0.0OpenServer 5.0.7UnixWare 7.1.4

Written · Last revised

Problem

I had a SCO UnixWare 7.1.3 server with SAMBA 2.2.8 installed.

I was able to print successfully from my UW713 server via samba "smbclient" command to a shared printer on a Windows XP client.

My print command was put on a customized shell print script that ran the following command:

cat $FILE | /usr/lib/samba/bin/smbclient
"\\\\$XP_HOST\\$XP_PRINTER" $SAMBAPASSWORD -U $SAMBAUSER -N
-P $PRINT_DOMAIN -c "print -" 2>&1

Then I updated my UW713 server to UW714 with MP3 and Samba 3.0.10.

Now my printing to the Windows XP shared printer fails by using the same customized shell print script.

I keep getting the following Error message when printing:

"ERROR: Unable to fetch machine password"

I also get the same error message when I run the following simple print command from the command line:

# cat /etc/hosts | /usr/lib/samba/bin/smbclient
"\\\\<XP_box>\<XP_shared_printer_name>" -N -c  "print -"

I also have the same problem on SCO OpenServer6 & SCO OpenServer 5.0.7 with samba ver. 3.0.20

Cause

There has been a change in the "smbclient" binary regarding the "-P" option from the Samba 2.2.X to 3.0.X.

Under Samba 2.2.X, the option "-P" in smbclient means:

"use this share as a printer"

While under Samba 3.0.X, the "-P" option means:

"Make queries to the external server using the machine account of the local server."

In other words, use the stored machine account password.

So, if you have not trusted the UW714 Samba 3.0.10 server on the windows XP box and used the "-P", you get the above ERROR message.

Solution

Just remove the "-P" from the "smbclient" command.

In other words, do not use the "-P" option.

ie. To add the printer:
1.  Create a directory:
# mkdir -p /local/printer
2.  To check the resources available use:
# smbclient -L <WINDOWS SERVER/CLIENT HOSTING THE PRINTER> -N
3.  Create a 'smbprint.<printername>' file consisting of the example
    /usr/share/doc/packages/samba/examples/printing/smbprint.sysv
as:
#!/bin/sh
#
# @(#) smbprint.sysv version 1.0 Ross Wakelin <r.wakelin@march.co.uk>
#
#      Version 1.0 13 January 1995
#               modified from the original smbprint (bsd) script
#
# this script is a System 5 printer interface script. It
# uses the smbclient program to print the file to the specified smb-based
# server and service.
#
# To add this to your lp system, copy this file into your samba directory
# (the example here is /opt/samba), modify the server and service variables
# and then execute the following command (as root)
#
# lpadmin -punixprintername -v/dev/null -i/opt/samba/smbprint
#
# where unixprintername is the name that the printer will be known as
# on your unix box.
#
# the script smbprint will be copied into your printer administration
# directory (/usr/lib/lp or /etc/lp) as a new interface
# (interface/unixprintername)
# Then you have to enable unixprintername and accept unixprintername
#
# This script will then be called by the lp service to print the files
# This script will have 6 or more parameters passed to it by the lp service.
# The first five will contain details of the print job, who queued it etc,
# while parameters 6 onwards are a list of files to print.  We just
# cat these at the samba client.
#
# Set these to the server and service you wish to print to
# In this example I have a WfWg PC called "lapland" that has a printer
# exported called "printer" with no password.
#
# clear out the unwanted parameters
shift;shift;shift;shift;shift
# now the argument list is just the files to print

server=<WINDOWS SERVER/CLIENT HOSTING THE PRINTER> service=<Windows Share name> user=<my user or administrator> password=<their password>

(
# NOTE You may wish to add the line `echo translate' if you want automatic
# CR/LF translation when printing.
       echo translate
        echo "print -"
        cat $*
        echo "\F"
) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $user > /dev/null
exit $?
You may wish to add a "2>&1" after "/dev/null" as Windows 2003 may
email to root a status report of each print denoting it's size.
4.  Add the printer with the command, with or without CuPs enabled
    with:
# lpadmin -p <unixprintername> -v /dev/null
          -i /local/printer/smbprint.<printername>

Remember that once created you can change the contents by changing /etc/lp/interfaces/<unixprintername>

See also

man smbclient(1)

From the Xinuos technical article database, record 126741. Reproduced with permission. The original is at www.sco.com/ta/126741, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.