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.sysvNext, 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 nameThe 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 parametersshift;shift;shift;shift;shift# now the argument list is just the files to printserver=
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/nullexit $?--- 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.