The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации / Документация по FreeBSD / Руководства по FreeBSD на английском

8.9 Microsoft Networking Client printing with Samba

Although LPR is a time-tested and truly cross-platform printing solution, sites with a majority of Windows clients running Microsoft Networking have an alternate printing mechanism--Samba. Samba can provide print services to clients running SMB-compatible network clients. With a running Samba installation, the administrator may "share out" printers as well as filesystem directories from the FreeBSD system.

Printers accessed with Samba must be defined both in the /etc/printcap file and the /usr/local/etc/smb.conf file. If the individual printers are defined in the smb.conf file with the printer driver= statement set to the exact model name of the printer, the "Auto printer driver install" feature of Windows NT and Win95/98 is activated. This automatically loads the correct printer driver if the user clicks on the print queue in Network Neighborhood under Windows 95 or NT 4.0. The restriction, of course, is that the printer model must be in the Windows client driver database.

The smb.conf file also defines the print command used to pass jobs to the UNIX print spool. It is a good idea to redefine this via the print command option to lpr -s -P %p %s; rm %s. This turns on soft linking, so that large print jobs don't get truncated.

In operation, the SMB-networking client builds the print job on itself and then transfers the entire job over the network to the Samba server. On the server, Samba has it's own temporary print spool directory to which the job is copied. Once the job has been completely received, it is then passed to the UNIX print spooler.

Figure 8-6. Microsoft Networking Client printing with Samba

8.9.1 Client access issues

Because a Windows client formats print jobs before sending them to the server, the administrator may want to hide some of the specialty print queues on the server. For example, the queue that converts LF to CRLF for UNIX text printouts would probably not be shared out. To make such queues invisible, the browseable=no option can be turned on in the smb.conf file. Also, the load printers option must be set to no to allow individual printer definitions.

Note: In general, the only print queues that should be visible through Samba are the "raw" print queues that are set up by the administrator to allow incoming preformatted print jobs.

Windows clients that print to Samba print queues on the UNIX system can view and cancel print jobs in the print queue. They cannot pause them, however, which is a difference between Novell and Windows NT Server print queues. They also cannot prioritize print jobs from the print queue window, although the administrator can reprioritize print jobs that are in the queue from a command shell on the FreeBSD server.

8.9.2 Printer entries in configuration files

Following are listings of sample /etc/printcap and smb.conf files used on the system to provide print services. An explanation of the interaction of these files follows.

Example 8-1. /etc/printcap

    #
    #
    # The printer in lpt0 is a PostScript printer.  The nec-crlf entry
    # is for testing the printer when it is switched into HP LaserJet III
    # mode.
    #
    
    lp|local line printer:\
      :lp=/dev/lpt0:sd=/var/spool/output/lpd:\
      :lf=/var/log/lpd-errs:sh:mx#0:
    
    #
    
    nec-crlf|NEC Silentwriter 95 in ASCII mode with UNIX text filter:\
      :lp=/dev/lpt0:sd=/usr/lpdspool/nec-crlf:\
      :lf=/var/log/lpd-errs:sh:mx#0:\
      :if=/usr/local/libexec/crlfilter:tr=\f:
    
    #
    
    nec-raw|NEC Silentwriter 95 used for PostScript passthrough printing:\
      :lp=/dev/lpt0:sd=/usr/lpdspool/nec-raw:\
      :lf=/var/log/lpd-errs:sh:mx#0:
    
    #
    
    nec-ps-banner|NEC Silentwriter 95 with PostScript banner page created:\
      :lp=/dev/lpt0:sd=/usr/lpdspool/nec-ps-banner:\
      :lf=/var/log/lpd-errs:sh:mx#0:if=/usr/local/libexec/psbanner:
    
    #
    #

Example 8-2. /usr/local/etc/smb.conf

    [global]
    comment = FreeBSD - Samba %v
    log file = /var/log/samba.log
    dont descend = /dev,/proc,/root,/stand
    print command = lpr -s -P %p %s; rm %s
    interfaces = X.X.X.X (the system IP number goes here)
    printing = bsd
    map archive = no
    status = yes
    public = yes
    read only = no
    preserve case = yes
    strip dot = yes
    security = share
    guest ok = no
    password level = 1
    dead time = 15
    domain master = yes
    workgroup = WORKGROUP
    
    [homes]
    browseable = no
    comment = User Home Directory
    create mode = 0775
    public = no
    
    [printers]
    path = /var/spool
    comment = Printers
    create mode = 0700
    browseable = no
    read only = yes
    public = no
    
    [lp]
    printable = yes
    browseable = no
    
    [nec-raw]
    comment = Main PostScript printer driver for Windows clients
    printer driver = NEC SilentWriter 95
    printable = yes
    browseable = yes
    
    [wwwroot]
    path = /usr/local/www
    read only = no
    create mode = 0775
    comment = Internal Web Server

8.9.3 Browsing output

Following is the output of a net view command executed at a DOS prompt under Windows 95:

    Shared resources at \\SERVER
    
    Sharename Type    Comment
    --------------------------------------------------------------------
    nec-crlf  Print   NEC Silentwriter 95 in ASCII mode
    nec-raw   Print   Main PostScript printer driver
    tedm      Disk    User Home Directory
    wwwroot   Disk    Internal Web Server
    
    The command was completed successfully.

In the /etc/printcap file four print queues are defined, all tied to the printer plugged into the parallel port on the FreeBSD server. The first is lp, the generic local line printer. Since this print queue generally has a filter placed on it to format jobs from the UNIX print queue properly, it should not be visible on the SMB network (i.e., visible in Network Neighborhood). The second queue, nec-crlf, has a filter that converts UNIX text to text that prints without stairstepping, so it also should be hidden from the SMB network. The third, nec-raw, should be visible on the network because this is the spool that the Windows clients use. The last queue, nec-ps-banner, is another specialty queue for UNIX local printing and thus should not be visible.

When the smb.conf file is parsed, the default entry [printers] is first read and used as a set of defaults for printers that are going to be shared out. Next, the /etc/printcap file is read to get a list of all printers on the server. Last, each printer is checked for a service name in the smb.conf file that contains settings that override the set of defaults.

In the listing of what resources are visible on the network, both nec-crlf and nec-raw print queues are visible, and lp and nec-ps-banner is not. lp is not visible because there is a specific entry, [lp] in the smb.conf file that blocks it. nec-ps-banner doesn't have such an entry, but because the print queue name is not a legal length for a SMB name, it isn't shared out either.

The nec-crlf printer is visible so as to illustrate another point - comments. If a print queue has no entry in the smb.conf file and is built by scanning the /etc/printcap file and using the [printers] defaults, the comment is taken from the /etc/printcap file next to the queue definition name. Otherwise, if an entry is made for the printer in the smb.conf file the comment is taken from the entry in smb.conf.

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру