Technical article 125213

How to configure a printer on OpenServer to print to a Windows shared printer using Samba?

OpenServer 5.0.5OpenServer 5.0.6OpenServer 5.0.7

Written · Last revised

Problem

I want to configure a local printer on Openserver to send print jobs to a Windows shared printer, using Samba provided utilities. How do I configure this?

Solution

Please create the included smbprint.sysv file in /usr/lib/samba/bin/ and make sure the file permissions/ownership are 755 and root:sys.

To setup the printer from scratch with lpadmin, run the following set of commands, substituting "printer" for the name of the printer as it will be known locally to the OpenServer printing subsystem:

/usr/lib/lpadmin -p printer -v /dev/null -i
/usr/lib/samba/bin/smbprint.sysv
Next, change directories to
/usr/spool/lp/admins/lp/interfaces/ and edit the file
matching the printer's name.  This is just a copy of
smbprint.sysv created earlier, but we need to tailor the
script to point to a specific Windows server, shared
printer and password.  A password may or may not be
required, depending on how the Windows printer was
configured for network access.
Find the lines:
server=
service=
password=""

and change them to the system and printer name as known by the windows printer:

server=winbox      ###<---- windows NetBios name
service=winprint   ###<---- windows Printer name

The password entry in the script should not need modification unless required by the windows printer configuration.

After saving these changes, the final step is to enable the printer within the printing subsystem, running the following commands, again substituting "printer" with the name of the printer you selected:

accept printer
enable printer
--- SMBPRINT.SYSV SCRIPT BEGIN HERE ---
#!/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.
#
# clear out the unwanted parameters
shift;shift;shift;shift;shift
# now the argument list is just the files to print
server=
service=
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 $*
) | /usr/lib/samba/bin/smbclient "\\\\$server\\$service" $password -N\
-P > /dev/null
exit $?
--- SMBPRINT.SYSV SCRIPT END HERE ---
NOTES:    There is no need to alter the smbclient command in the
          interface to add the -U guest option, as the smbclient
          command on Openserver already assumes this if an account
          is not specified. If using Windows NT/2000/XP, you will
          need to make sure that the guest account is active.

If you have any LF/CR stair-stepping printing issues, try commenting out the "echo translate" line towards the bottom of the printer interface script.

From the Xinuos technical article database, record 125213. Reproduced with permission. The original is at www.sco.com/ta/125213, 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.