|
Sams Teach Yourself Samba in 24 Hours |
|||||||||||||||||
|
Hour 8: Printers |
|||||||||||||||||
|
In some situations, you might want to print from your UNIX servers to a printer that is connected to a Windows client. Samba can accomplish this. To set this up, you need to configure an appropriate print filter for the printing system under UNIX.
This section covers doing this for Berkeley-style printing (LPD, PLP, and LPRNG) as well as System V-style printing.
Samba comes with a small shell script called smbprint (or smbprint.sysv for System V systems). You can use this program to accept print jobs and queue them to printers shared on remote Windows systems. You do this in different ways, depending on whether your UNIX system uses BSD-style printing or System V-style printing.
In either case, the printer must be shared on the Windows machine. You do this with the Sharing menu item when you right-click a printer in Windows 9x or Windows NT. See Hour 14, "Windows 9x and Windows NT," for more details.
The smbprint (or smbprint.sysv) script uses smbclient to copy the print file from UNIX to Windows (perhaps with end-of-line translation if required) on a printer share. The smbclient utility is described in Hour 13, "UNIX (smbclient, smbfs, smbwrapper, and Various Utilities)."
BSD-style printing uses LPD and is controlled from a file called /etc/printcap. All printers are defined in the printcap file. To specify that a particular printer should send its print jobs to a shared printer on a remote Windows 9x system, perform the following steps:
1. Define the printer; that is, build a printcap entry either manually or with your favorite tool.
2. In the spool directory created for the printer, usually /var/spool/<printer-name>, create a file called .config (make sure that the name starts with a period) and place the following lines in the file:
server=<server name> service=<printer share name> password=<password>
3. Change (or add) the input filter in the printcap entry for your printer to:
:if=<directory path to smbprint>/smbprint:\
4. Restart the printer.
For example, if the local printer's name is hawk_print, the remote server is HAWK, the printer share is called MY_PRINTER, and no password is required to access the share, your .config file would look like:
server=HAWK service=MY_PRINTER password=""
On a Red Hat Linux system, you would create this file in the directory /var/spool/lpd/hawk_print, and the entry in the printcap file would look like
:if=/usr/bin/smbprint:\
You generally do not need to do this for printers located on Windows NT systems, because you can install LPD on Windows NT. Please refer to the printcap man page for more information on configuring remote LPD printers.
System V-style printing is different from BSD-style printing and uses lp. Samba supports printing to Windows machines from System V systems using the script smbprint.sysv located in the examples/printing directory under the Samba source tree.
This script is a modified version of the BSD-style script. To use it, make a modified version of the script to specify the Windows server, service, and service password. These are located in a block in the program:
server=admin service=hplj2 password=""
Change each of these to the correct values, and then install the script as an interface script for your queue and start printing using
lpadmin -punixprintername -v/dev/null -i./smbprint.sysv enable unixprintername accept unixprintername
For example, if the local printer's name is hawk_print, the remote server is HAWK, the printer share is called MY_PRINTER, and no password is required to access the remote share, the changes to smbprint.sysv required would look like:
server=HAWK service=MY_PRINTER password=""
The commands required to set up and enable this printer would be
lpadmin -phawk_print -v /dev/null -i./smbprint.sysv enable hawk_print accept hawk_print
You would generally not need to do this for Windows NT systems, because Windows NT supports LPD, and lpadmin can configure a remote BSD-based printer. Please refer to the lpadmin man page for more information.
|
Sams Teach Yourself Samba in 24 Hours |
|||||||||||||||||
|
Hour 8: Printers |
|||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.