File: smb.htm

package info (click to toggle)
lprng 3.8.10-1.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 13,076 kB
  • ctags: 4,348
  • sloc: ansic: 35,394; sh: 10,756; perl: 2,210; makefile: 1,046
file content (246 lines) | stat: -rw-r--r-- 9,484 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org">
    <title>SAMBA and LPRng</title>
    <meta name="GENERATOR" content=
    "Modular DocBook HTML Stylesheet Version 1.71 ">
    <link rel="HOME" title=" LPRng-HOWTO" href="index.htm">
    <link rel="UP" title="Installation" href="installation.htm">
    <link rel="PREVIOUS" title=
    "Emulation for UNIX SystemV lp and lpstat " href=
    "lpsimulation.htm">
    <link rel="NEXT" title="Security Concerns " href="setuid.htm">
  </head>

  <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
  "#0000FF" vlink="#840084" alink="#0000FF">
    <div class="NAVHEADER">
      <table summary="Header navigation table" width="100%" border=
      "0" cellpadding="0" cellspacing="0">
        <tr>
          <th colspan="3" align="center">LPRng-HOWTO: 1 Apr 2002
          (For LPRng-3.8.10)</th>
        </tr>

        <tr>
          <td width="10%" align="left" valign="bottom"><a href=
          "lpsimulation.htm" accesskey="P">Prev</a></td>

          <td width="80%" align="center" valign="bottom">Chapter 2.
          Installation</td>

          <td width="10%" align="right" valign="bottom"><a href=
          "setuid.htm" accesskey="N">Next</a></td>
        </tr>
      </table>
      <hr align="LEFT" width="100%">
    </div>

    <div class="SECT1">
      <h1 class="SECT1"><a name="SMB">2.12. SAMBA and <b class=
      "APPLICATION">LPRng</b></a></h1>

      <p>The SMB network protocol is used by many Microsoft
      Operating Systems to implement file and printer sharing.
      SAMBA is a UNIX package that implements the SMB protocol and
      provides a simple and easy way to import and export file
      systems and printer facilities. The web site for SAMBA is <a
      href="http://www.samba.org" target=
      "_top">http://www.samba.org</a>. The SAMBA code is extremely
      easy to install and the <span class="ACRONYM">SWAT</span>
      (Samba Web Administration Tool) makes configuration almost
      trivial.</p>

      <p>The See the SAMBA <tt class=
      "FILENAME">doc/text/Printing.txt</tt> and related
      documentation for details on printing. In the <tt class=
      "FILENAME">samba.conf</tt> file <tt class=
      "LITERAL">[global]</tt> section or in the SWAT page for
      printing configuration you need to specify the that you want
      to have Samba handle printing, the <tt class=
      "LITERAL">print</tt>, <b class="APPLICATION">lpq</b>, and <b
      class="APPLICATION">lprm</b> commands to be used when a user
      prints a job, asks for status, or removes a job, and a
      temporary directory to hold print jobs when they are
      submitted. The following is a simple example of to set up
      printing for authenticated users.</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN1343"></a>
<pre class="SCREEN">
    [printers]
        path = /var/spool/lpd/samba
        #  ---  do not use the Samba default path = /tmp
        print ok = yes
        printing = lprng
        load printers = yes
        guest ok = no
        printcap name = /etc/printcap
        print command =      /usr/bin/lpr  -P%p -r %s
        lpq command   =      /usr/bin/lpq  -P%p
        lprm command  =      /usr/bin/lprm -P%p %j
        lppause command =    /usr/sbin/lpc hold %p %j
        lpresume command =   /usr/sbin/lpc release %p %j
        queuepause command = /usr/sbin/lpc  -P%p stop
        queueresume command = /usr/sbin/lpc -P%p start
</pre>
      </div>
      <br>
      <br>

      <ol type="1">
        <li>
          <p>Samba will make a copy of the files to be printed in
          the directory specified by <tt class="LITERAL">path</tt>.
          If the print operation fails then sometimes the print
          file is left in the directory.</p>
        </li>

        <li>
          <p>The directory should have the same ownership and
          permissions as <tt class="FILENAME">/tmp</tt>, i.e.-
          owner and group <tt class="LITERAL">root</tt> and <tt
          class="LITERAL">bin</tt>, with <tt class=
          "LITERAL">01777</tt> permissions, where <tt class=
          "LITERAL">01000</tt> is the sticky bit.</p>

          <p>A directory whose `sticky bit' is set becomes an
          append-only directory, or, more accurately, a directory
          in which the deletion of files is re- stricted. A file in
          a sticky directory may only be removed or renamed by a
          user if the user has write permission for the directory
          and the user is the owner of the file, the owner of the
          directory, or the super-user. This feature is usefully
          applied to directories such as /tmp which must be
          publicly writable but should deny users the license to
          arbitrarily delete or rename each others' files.</p>
        </li>

        <li>
          <p>The directory should be examined periodically and
          files older then a day should be removed. The following
          command can be used to do this, and should be put in a
          file that is periodically (one a day) executed by the <b
          class="APPLICATION">cron</b> facility:</p>

          <div class="INFORMALEXAMPLE">
            <a name="AEN1360"></a>
<pre class="SCREEN">
    find /var/spool/lpd/samba -type f -mtime 2d -exec rm -f {} \;
</pre>
          </div>
          <br>
          <br>
        </li>

        <li>
          <p>You must specify the print method as <tt class=
          "LITERAL">printing = lprng</tt>. This will allow Samba to
          parse the <b class="APPLICATION">LPRng</b> <b class=
          "APPLICATION">lpq</b> status format correctly.</p>
        </li>

        <li>
          <p>You must put all of the printers which Samba has
          access to in the <tt class="FILENAME">printcap</tt> file.
          Your Samba server may support reading the printcap file
          by using a program. In this case the printcap file entry
          can be one of the following:</p>

          <div class="INFORMALEXAMPLE">
            <a name="AEN1370"></a>
<pre class="SCREEN">
    [printers]
      #
        printcap name = |/usr/local/libexec/filters/getpc
      # or
        printcap name = |/usr/bin/lpc client all 
    
    #!/bin/sh
    # getpc program
    /usr/bin/lpq -as | /bin/sed -e 's/[@:].*//p'
   
</pre>
          </div>
          <br>
          <br>

          <p>The <tt class="LITERAL">lpc client all</tt> command
          will generate the printcap entries for all of the
          printers. This was done to support Samba and other
          printer gateway systems. You can also use a simple script
          to modify the output of the printer status command as
          shown in the example.</p>
        </li>

        <li>
          <p>Samba can be configured to allow guests or
          non-authenticated users to spool print jobs.
          Unfortunately, by default <b class="APPLICATION">lpr</b>
          will mark the jobs as submitted by the Samba server, not
          the remote users. To solve this problem, the <tt class=
          "COMMAND">lpr -U%U@%M</tt> option causes <b class=
          "APPLICATION">lpr</b> to mark the jobs as submitted by
          user <tt class="LITERAL">%U</tt> on host <tt class=
          "LITERAL">%M</tt>, instead of the Samba server process.
          The use of this option is restricted to root and a set of
          userids listed in the <a href=
          "allowusersetting.htm">allow_user_setting</a>
          configuration option. If the userid of the submitter is
          not in this list, then the option is quietly ignored. The
          <tt class="COMMAND">-U%U@M</tt> can also be used with the
          other LPRng commands as well. For example:</p>

          <div class="INFORMALEXAMPLE">
            <a name="AEN1383"></a>
<pre class="SCREEN">
    [printers]
        guest ok = yes
        print command =       /usr/bin/lpr  -U%U@%M -P%p -r %s
        lpq command   =       /usr/bin/lpq  -U%U@%M -P%p
        lprm command  =       /usr/bin/lprm -U%U@%M -P%p %j
        lppause command =     /usr/sbin/lpc -U%U@%M hold %p %j
        lpresume command =    /usr/sbin/lpc -U%U@%M release %p %j
        queuepause command =  /usr/sbin/lpc -U%U@%M -P%p stop
        queueresume command = /usr/sbin/lpc -U%U@%M -P%p start
</pre>
          </div>
          <br>
          <br>
        </li>
      </ol>
    </div>

    <div class="NAVFOOTER">
      <hr align="LEFT" width="100%">

      <table summary="Footer navigation table" width="100%" border=
      "0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="33%" align="left" valign="top"><a href=
          "lpsimulation.htm" accesskey="P">Prev</a></td>

          <td width="34%" align="center" valign="top"><a href=
          "index.htm" accesskey="H">Home</a></td>

          <td width="33%" align="right" valign="top"><a href=
          "setuid.htm" accesskey="N">Next</a></td>
        </tr>

        <tr>
          <td width="33%" align="left" valign="top">Emulation for
          UNIX SystemV <b class="APPLICATION">lp</b> and <b class=
          "APPLICATION">lpstat</b></td>

          <td width="34%" align="center" valign="top"><a href=
          "installation.htm" accesskey="U">Up</a></td>

          <td width="33%" align="right" valign="top">Security
          Concerns</td>
        </tr>
      </table>
    </div>
  </body>
</html>