summaryrefslogtreecommitdiff
path: root/docs/htmldocs/printing.html
blob: 0bdbd65198e081f1230bbec20fa61acb93fb04cb (plain)
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Printing Support in Samba 2.2.x</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SAMBA Project Documentation"
HREF="Samba-HOWTO.html"><LINK
REL="PREVIOUS"
TITLE="UNIX Permission Bits and Windows NT Access Control Lists"
HREF="unix-permissions.html"><LINK
REL="NEXT"
TITLE="Debugging Printing Problems"
HREF="printingdebug.html"></HEAD
><BODY
CLASS="CHAPTER"
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"
>SAMBA Project Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="unix-permissions.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="printingdebug.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="PRINTING">Chapter 7. Printing Support in Samba 2.2.x</H1
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN902">7.1. Introduction</H1
><P
>Beginning with the 2.2.0 release, Samba supports 
the native Windows NT printing mechanisms implemented via 
MS-RPC (i.e. the SPOOLSS named pipe).  Previous versions of 
Samba only supported LanMan printing calls.</P
><P
>The additional functionality provided by the new 
SPOOLSS support includes:</P
><P
></P
><UL
><LI
><P
>Support for downloading printer driver 
	files to Windows 95/98/NT/2000 clients upon demand.
	</P
></LI
><LI
><P
>Uploading of printer drivers via the 
	Windows NT Add Printer Wizard (APW) or the 
	Imprints tool set (refer to <A
HREF="http://imprints.sourceforge.net"
TARGET="_top"
>http://imprints.sourceforge.net</A
>). 
	</P
></LI
><LI
><P
>Support for the native MS-RPC printing 
	calls such as StartDocPrinter, EnumJobs(), etc...  (See 
	the MSDN documentation at <A
HREF="http://msdn.microsoft.com/"
TARGET="_top"
>http://msdn.microsoft.com/</A
> 
	for more information on the Win32 printing API)
	</P
></LI
><LI
><P
>Support for NT Access Control Lists (ACL) 
	on printer objects</P
></LI
><LI
><P
>Improved support for printer queue manipulation 
	through the use of an internal databases for spooled job 
	information</P
></LI
></UL
><P
>There has been some initial confusion about what all this means
and whether or not it is a requirement for printer drivers to be 
installed on a Samba host in order to support printing from Windows 
clients.  A bug existed in Samba 2.2.0 which made Windows NT/2000 clients 
require that the Samba server possess a valid driver for the printer.  
This is fixed in Samba 2.2.1 and once again, Windows NT/2000 clients
can use the local APW for installing drivers to be used with a Samba 
served printer.  This is the same behavior exhibited by Windows 9x clients.
As a side note, Samba does not use these drivers in any way to process 
spooled files.  They are utilized entirely by the clients.</P
><P
>The following MS KB article, may be of some help if you are dealing with
Windows 2000 clients:  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>How to Add Printers with No User 
Interaction in Windows 2000</I
></SPAN
></P
><P
><A
HREF="http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP"
TARGET="_top"
>http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP</A
></P
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN924">7.2. Configuration</H1
><DIV
CLASS="WARNING"
><P
></P
><TABLE
CLASS="WARNING"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>[print$] vs. [printer$]</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Previous versions of Samba recommended using a share named [printer$].  
This name was taken from the printer$ service created by Windows 9x 
clients when a printer was shared.  Windows 9x printer servers always have 
a printer$ service which provides read-only access via no 
password in order to support printer driver downloads.</P
><P
>However, the initial implementation allowed for a 
parameter named <TT
CLASS="PARAMETER"
><I
>printer driver location</I
></TT
> 
to be used on a per share basis to specify the location of 
the driver files associated with that printer.  Another 
parameter named <TT
CLASS="PARAMETER"
><I
>printer driver</I
></TT
> provided 
a means of defining the printer driver name to be sent to 
the client.</P
><P
>These parameters, including <TT
CLASS="PARAMETER"
><I
>printer driver
file</I
></TT
> parameter, are being deprecated and should not 
be used in new installations.  For more information on this change, 
you should refer to the <A
HREF="printing.html#MIGRATION"
>Migration section</A
>
of this document.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN935">7.2.1. Creating [print$]</H2
><P
>In order to support the uploading of printer driver 
files, you must first configure a file share named [print$].  
The name of this share is hard coded in Samba's internals so 
the name is very important (print$ is the service used by 
Windows NT print servers to provide support for printer driver 
download).</P
><P
>You should modify the server's smb.conf file to add the global
parameters and to create the 
following file share (of course, some of the parameter values,
such as 'path' are arbitrary and should be replaced with
appropriate values for your site):</P
><P
><PRE
CLASS="PROGRAMLISTING"
>[global]
    ; members of the ntadmin group should be able
    ; to add drivers and set printer properties
    ; root is implicitly a 'printer admin'
    printer admin = @ntadmin

[print$]
    path = /usr/local/samba/printers
    guest ok = yes
    browseable = yes
    read only = yes
    ; since this share is configured as read only, then we need
    ; a 'write list'.  Check the file system permissions to make
    ; sure this account can copy files to the share.  If this
    ; is setup to a non-root account, then it should also exist
    ; as a 'printer admin'
    write list = @ntadmin,root</PRE
></P
><P
>The <A
HREF="smb.conf.5.html#WRITELIST"
TARGET="_top"
><TT
CLASS="PARAMETER"
><I
>write list</I
></TT
></A
> is used to allow administrative 
level user accounts to have write access in order to update files 
on the share.  See the <A
HREF="smb.conf.5.html"
TARGET="_top"
>smb.conf(5) 
man page</A
> for more information on configuring file shares.</P
><P
>The requirement for <A
HREF="smb.conf.5.html#GUESTOK"
TARGET="_top"
><B
CLASS="COMMAND"
>guest 
ok = yes</B
></A
> depends upon how your
site is configured.  If users will be guaranteed to have 
an account on the Samba host, then this is a non-issue.</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Author's Note</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>The non-issue is that if all your Windows NT users are guaranteed to be 
authenticated by the Samba server (such as a domain member server and the NT 
user has already been validated by the Domain Controller in 
order to logon to the Windows NT console), then guest access 
is not necessary.  Of course, in a workgroup environment where 
you just want to be able to print without worrying about 
silly accounts and security, then configure the share for 
guest access.  You'll probably want to add <A
HREF="smb.conf.5.html#MAPTOGUEST"
TARGET="_top"
><B
CLASS="COMMAND"
>map to guest = Bad User</B
></A
> in the [global] section as well.  Make sure 
you understand what this parameter does before using it 
though. --jerry</P
></TD
></TR
></TABLE
></DIV
><P
>In order for a Windows NT print server to support 
the downloading of driver files by multiple client architectures,
it must create subdirectories within the [print$] service
which correspond to each of the supported client architectures.
Samba follows this model as well.</P
><P
>Next create the directory tree below the [print$] share 
for each architecture you wish to support.</P
><P
><PRE
CLASS="PROGRAMLISTING"
>[print$]-----
        |-W32X86           ; "Windows NT x86"
        |-WIN40            ; "Windows 95/98"
        |-W32ALPHA         ; "Windows NT Alpha_AXP"
        |-W32MIPS          ; "Windows NT R4000"
        |-W32PPC           ; "Windows NT PowerPC"</PRE
></P
><DIV
CLASS="WARNING"
><P
></P
><TABLE
CLASS="WARNING"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>ATTENTION!  REQUIRED PERMISSIONS</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>In order to currently add a new driver to you Samba host, 
one of two conditions must hold true:</P
><P
></P
><UL
><LI
><P
>The account used to connect to the Samba host 
	must have a uid of 0 (i.e. a root account)</P
></LI
><LI
><P
>The account used to connect to the Samba host
	must be a member of the <A
HREF="smb.conf.5.html#PRINTERADMIN"
TARGET="_top"
><TT
CLASS="PARAMETER"
><I
>printer 
	admin</I
></TT
></A
> list.</P
></LI
></UL
><P
>Of course, the connected account must still possess access
to add files to the subdirectories beneath [print$]. Remember
that all file shares are set to 'read only' by default.</P
></TD
></TR
></TABLE
></DIV
><P
>Once you have created the required [print$] service and 
associated subdirectories, simply log onto the Samba server using 
a root (or <TT
CLASS="PARAMETER"
><I
>printer admin</I
></TT
>) account
from a Windows NT 4.0/2k client.  Open "Network Neighbourhood" or
"My Network Places" and browse for the Samba host.  Once you have located
the server, navigate to the "Printers..." folder.
You should see an initial listing of printers
that matches the printer shares defined on your Samba host.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN970">7.2.2. Setting Drivers for Existing Printers</H2
><P
>The initial listing of printers in the Samba host's 
Printers folder will have no real printer driver assigned 
to them.  By default, in Samba 2.2.0 this driver name was set to 
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>NO PRINTER DRIVER AVAILABLE FOR THIS PRINTER</I
></SPAN
>.
Later versions changed this to a NULL string to allow the use
tof the local Add Printer Wizard on NT/2000 clients.
Attempting to view the printer properties for a printer
which has this default driver assigned will result in 
the error message:</P
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Device settings cannot be displayed.  The driver 
for the specified printer is not installed, only spooler 
properties will be displayed.  Do you want to install the 
driver now?</I
></SPAN
></P
><P
>Click "No" in the error dialog and you will be presented with
the printer properties window.  The way to assign a driver to a 
printer is to either</P
><P
></P
><UL
><LI
><P
>Use the "New Driver..." button to install 
	a new printer driver, or</P
></LI
><LI
><P
>Select a driver from the popup list of 
	installed drivers.  Initially this list will be empty.</P
></LI
></UL
><P
>If you wish to install printer drivers for client 
operating systems other than "Windows NT x86", you will need 
to use the "Sharing" tab of the printer properties dialog.</P
><P
>Assuming you have connected with a root account, you 
will also be able modify other printer properties such as 
ACLs and device settings using this dialog box.</P
><P
>A few closing comments for this section, it is possible 
on a Windows NT print server to have printers
listed in the Printers folder which are not shared.  Samba does
not make this distinction.  By definition, the only printers of
which Samba is aware are those which are specified as shares in
<TT
CLASS="FILENAME"
>smb.conf</TT
>.</P
><P
>Another interesting side note is that Windows NT clients do
not use the SMB printer share, but rather can print directly 
to any printer on another Windows NT host using MS-RPC.  This
of course assumes that the printing client has the necessary
privileges on the remote host serving the printer.  The default
permissions assigned by Windows NT to a printer gives the "Print"
permissions to the "Everyone" well-known group.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN987">7.2.3. Support a large number of printers</H2
><P
>One issue that has arisen during the development
phase of Samba 2.2 is the need to support driver downloads for
100's of printers.  Using the Windows NT APW is somewhat 
awkward to say the list.  If more than one printer are using the 
same driver, the <A
HREF="rpcclient.1.html"
TARGET="_top"
><B
CLASS="COMMAND"
>rpcclient's
setdriver command</B
></A
> can be used to set the driver
associated with an installed driver.  The following is example
of how this could be accomplished:</P
><P
><PRE
CLASS="PROGRAMLISTING"
> 
<TT
CLASS="PROMPT"
>$ </TT
>rpcclient pogo -U root%secret -c "enumdrivers"
Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
 
[Windows NT x86]
Printer Driver Info 1:
     Driver Name: [HP LaserJet 4000 Series PS]
 
Printer Driver Info 1:
     Driver Name: [HP LaserJet 2100 Series PS]
 
Printer Driver Info 1:
     Driver Name: [HP LaserJet 4Si/4SiMX PS]
				  
<TT
CLASS="PROMPT"
>$ </TT
>rpcclient pogo -U root%secret -c "enumprinters"
Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
     flags:[0x800000]
     name:[\\POGO\hp-print]
     description:[POGO\\POGO\hp-print,NO DRIVER AVAILABLE FOR THIS PRINTER,]
     comment:[]
				  
<TT
CLASS="PROMPT"
>$ </TT
>rpcclient pogo -U root%secret \
<TT
CLASS="PROMPT"
>&gt; </TT
> -c "setdriver hp-print \"HP LaserJet 4000 Series PS\""
Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
Successfully set hp-print to driver HP LaserJet 4000 Series PS.</PRE
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN998">7.2.4. Adding New Printers via the Windows NT APW</H2
><P
>By default, Samba offers all printer shares defined in <TT
CLASS="FILENAME"
>smb.conf</TT
>
in the "Printers..." folder.  Also existing in this folder is the Windows NT 
Add Printer Wizard icon.  The APW will be show only if</P
><P
></P
><UL
><LI
><P
>The connected user is able to successfully
	execute an OpenPrinterEx(\\server) with administrative
	privileges (i.e. root or <TT
CLASS="PARAMETER"
><I
>printer admin</I
></TT
>).
	</P
></LI
><LI
><P
><A
HREF="smb.conf.5.html#SHOWADDPRINTERWIZARD"
TARGET="_top"
><TT
CLASS="PARAMETER"
><I
>show 
	add printer wizard = yes</I
></TT
></A
> (the default).
	</P
></LI
></UL
><P
>In order to be able to use the APW to successfully add a printer to a Samba 
server, the <A
HREF="smb.conf.5.html#ADDPRINTERCOMMAND"
TARGET="_top"
><TT
CLASS="PARAMETER"
><I
>add 
printer command</I
></TT
></A
> must have a defined value.  The program
hook must successfully add the printer to the system (i.e. 
<TT
CLASS="FILENAME"
>/etc/printcap</TT
> or appropriate files) and 
<TT
CLASS="FILENAME"
>smb.conf</TT
> if necessary.</P
><P
>When using the APW from a client, if the named printer share does 
not exist, <B
CLASS="COMMAND"
>smbd</B
> will execute the <TT
CLASS="PARAMETER"
><I
>add printer 
command</I
></TT
> and reparse to the <TT
CLASS="FILENAME"
>smb.conf</TT
>
to attempt to locate the new printer share.  If the share is still not defined,
an error of "Access Denied" is returned to the client.  Note that the 
<TT
CLASS="PARAMETER"
><I
>add printer program</I
></TT
> is executed under the context
of the connected user, not necessarily a root account.</P
><P
>There is a complementary <A
HREF="smb.conf.5.html#DELETEPRINTERCOMMAND"
TARGET="_top"
><TT
CLASS="PARAMETER"
><I
>delete
printer command</I
></TT
></A
> for removing entries from the "Printers..."
folder.</P
><P
>The following is an example <A
HREF="smb.conf.5.html#ADDPRINTERCOMMAN"
TARGET="_top"
><TT
CLASS="PARAMETER"
><I
>add printer command</I
></TT
></A
> script. It adds the appropriate entries to <TT
CLASS="FILENAME"
>/etc/printcap.local</TT
> (change that to what you need) and returns a line of 'Done' which is needed for the whole process to work.</P
><PRE
CLASS="PROGRAMLISTING"
>#!/bin/sh

# Script to insert a new printer entry into printcap.local
#
# $1, printer name, used as the descriptive name
# $2, share name, used as the printer name for Linux
# $3, port name
# $4, driver name
# $5, location, used for the device file of the printer
# $6, win9x location

#
# Make sure we use the location that RedHat uses for local printer defs
PRINTCAP=/etc/printcap.local
DATE=`date +%Y%m%d-%H%M%S`
LP=lp
RESTART="service lpd restart"

# Keep a copy
cp $PRINTCAP $PRINTCAP.$DATE
# Add the printer to $PRINTCAP
echo ""				 			&#62;&#62; $PRINTCAP
echo "$2|$1:\\" 					&#62;&#62; $PRINTCAP
echo "  :sd=/var/spool/lpd/$2:\\" 			&#62;&#62; $PRINTCAP
echo "  :mx=0:ml=0:sh:\\" 				&#62;&#62; $PRINTCAP
echo "  :lp=/usr/local/samba/var/print/$5.prn:" 	&#62;&#62; $PRINTCAP

touch "/usr/local/samba/var/print/$5.prn" &#62;&#62; /tmp/printadd.$$ 2&#62;&#38;1
chown $LP "/usr/local/samba/var/print/$5.prn" &#62;&#62; /tmp/printadd.$$ 2&#62;&#38;1

mkdir /var/spool/lpd/$2
chmod 700 /var/spool/lpd/$2
chown $LP /var/spool/lpd/$2
#echo $1 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
#echo $2 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
#echo $3 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
#echo $4 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
#echo $5 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
#echo $6 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
$RESTART &#62;&#62; "/usr/local/samba/var/print/$5.prn"
# Not sure if this is needed
touch /usr/local/samba/lib/smb.conf
#
# You need to return a value, but I am not sure what it means.
#
echo "Done"
exit 0</PRE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1028">7.2.5. Samba and Printer Ports</H2
><P
>Windows NT/2000 print servers associate a port with each printer.  These normally
take the form of LPT1:, COM1:, FILE:, etc...  Samba must also support the
concept of ports associated with a printer.  By default, only one printer port,
named "Samba Printer Port", exists on a system.  Samba does not really a port in
order to print, rather it is a requirement of Windows clients.  </P
><P
>Note that Samba does not support the concept of "Printer Pooling" internally 
either.  This is when a logical printer is assigned to multiple ports as 
a form of load balancing or fail over.</P
><P
>If you require that multiple ports be defined for some reason,
<TT
CLASS="FILENAME"
>smb.conf</TT
> possesses a <A
HREF="smb.conf.5.html#ENUMPORTSCOMMAND"
TARGET="_top"
><TT
CLASS="PARAMETER"
><I
>enumports 
command</I
></TT
></A
> which can be used to define an external program 
that generates a listing of ports on a system.</P
></DIV
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1036">7.3. The Imprints Toolset</H1
><P
>The Imprints tool set provides a UNIX equivalent of the 
	Windows NT Add Printer Wizard.  For complete information, please 
	refer to the Imprints web site at <A
HREF="http://imprints.sourceforge.net/"
TARGET="_top"
>	http://imprints.sourceforge.net/</A
> as well as the documentation 
	included with the imprints source distribution.  This section will 
	only provide a brief introduction to the features of Imprints.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1040">7.3.1. What is Imprints?</H2
><P
>Imprints is a collection of tools for supporting the goals 
		of</P
><P
></P
><UL
><LI
><P
>Providing a central repository information 
			regarding Windows NT and 95/98 printer driver packages</P
></LI
><LI
><P
>Providing the tools necessary for creating 
			the Imprints printer driver packages.</P
></LI
><LI
><P
>Providing an installation client which 
			will obtain and install printer drivers on remote Samba 
			and Windows NT 4 print servers.</P
></LI
></UL
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1050">7.3.2. Creating Printer Driver Packages</H2
><P
>The process of creating printer driver packages is beyond
		the scope of this document (refer to Imprints.txt also included
		with the Samba distribution for more information).  In short,
		an Imprints driver package is a gzipped tarball containing the
		driver files, related INF files, and a control file needed by the
		installation client.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1053">7.3.3. The Imprints server</H2
><P
>The Imprints server is really a database server that 
		may be queried via standard HTTP mechanisms.  Each printer 
		entry in the database has an associated URL for the actual
		downloading of the package.  Each package is digitally signed
		via GnuPG which can be used to verify that package downloaded
		is actually the one referred in the Imprints database.  It is 
		<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not</I
></SPAN
> recommended that this security check 
		be disabled.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1057">7.3.4. The Installation Client</H2
><P
>More information regarding the Imprints installation client 
		is available in the <TT
CLASS="FILENAME"
>Imprints-Client-HOWTO.ps</TT
> 
		file included with the imprints source package.</P
><P
>The Imprints installation client comes in two forms.</P
><P
></P
><UL
><LI
><P
>a set of command line Perl scripts</P
></LI
><LI
><P
>a GTK+ based graphical interface to 
			the command line perl scripts</P
></LI
></UL
><P
>The installation client (in both forms) provides a means
		of querying the Imprints database server for a matching
		list of known printer model names as well as a means to 
		download and install the drivers on remote Samba and Windows
		NT print servers.</P
><P
>The basic installation process is in four steps and 
		perl code is wrapped around <B
CLASS="COMMAND"
>smbclient</B
> 
		and <B
CLASS="COMMAND"
>rpcclient</B
>.</P
><P
><PRE
CLASS="PROGRAMLISTING"
>	
foreach (supported architecture for a given driver)
{
     1.  rpcclient: Get the appropriate upload directory 
         on the remote server
     2.  smbclient: Upload the driver files
     3.  rpcclient: Issues an AddPrinterDriver() MS-RPC
}
	
4.  rpcclient: Issue an AddPrinterEx() MS-RPC to actually
    create the printer</PRE
></P
><P
>One of the problems encountered when implementing 
		the Imprints tool set was the name space issues between 
		various supported client architectures.  For example, Windows 
		NT includes a driver named "Apple LaserWriter II NTX v51.8" 
		and Windows 95 calls its version of this driver "Apple 
		LaserWriter II NTX"</P
><P
>The problem is how to know what client drivers have 
		been uploaded for a printer.  As astute reader will remember 
		that the Windows NT Printer Properties dialog only includes 
		space for one printer driver name.  A quick look in the 
		Windows NT 4.0 system registry at</P
><P
><TT
CLASS="FILENAME"
>HKLM\System\CurrentControlSet\Control\Print\Environment
		</TT
></P
><P
>will reveal that Windows NT always uses the NT driver 
		name.  This is ok as Windows NT always requires that at least 
		the Windows NT version of the printer driver is present.  
		However, Samba does not have the requirement internally.  
		Therefore, how can you use the NT driver name if is has not 
		already been installed?</P
><P
>The way of sidestepping this limitation is to require 
		that all Imprints printer driver packages include both the Intel 
		Windows NT and 95/98 printer drivers and that NT driver is 
		installed first.</P
></DIV
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1079">7.4. <A
NAME="MIGRATION"
></A
>Migration to from Samba 2.0.x to 2.2.x</H1
><P
>Given that printer driver management has changed (we hope improved) in 
2.2 over prior releases, migration from an existing setup to 2.2 can 
follow several paths. Here are the possible scenarios for 
migration:</P
><P
></P
><UL
><LI
><P
>If you do not desire the new Windows NT 
	print driver support, nothing needs to be done.  
	All existing parameters work the same.</P
></LI
><LI
><P
>If you want to take advantage of NT printer 
	driver support but do not want to migrate the 
	9x drivers to the new setup, the leave the existing 
	<TT
CLASS="FILENAME"
>printers.def</TT
> file.  When smbd attempts 
	to locate a 
	9x driver for the printer in the TDB and fails it 
	will drop down to using the printers.def (and all 
	associated parameters).  The <B
CLASS="COMMAND"
>make_printerdef</B
> 
	tool will also remain for backwards compatibility but will 
	be removed in the next major release.</P
></LI
><LI
><P
>If you install a Windows 9x driver for a printer 
	on your Samba host (in the printing TDB), this information will 
	take precedence and the three old printing parameters
	will be ignored (including print driver location).</P
></LI
><LI
><P
>If you want to migrate an existing <TT
CLASS="FILENAME"
>printers.def</TT
> 
	file into the new setup, the current only solution is to use the Windows 
	NT APW to install the NT drivers and the 9x  drivers.  This can be scripted 
	using <B
CLASS="COMMAND"
>smbclient</B
> and <B
CLASS="COMMAND"
>rpcclient</B
>.  See the 
	Imprints installation client at <A
HREF="http://imprints.sourceforge.net/"
TARGET="_top"
>http://imprints.sourceforge.net/</A
> 
	for an example.
	</P
></LI
></UL
><DIV
CLASS="WARNING"
><P
></P
><TABLE
CLASS="WARNING"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Achtung!</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>The following <TT
CLASS="FILENAME"
>smb.conf</TT
> parameters are considered to 
be deprecated and will be removed soon.  Do not use them in new 
installations</P
><P
></P
><UL
><LI
><P
><TT
CLASS="PARAMETER"
><I
>printer driver file (G)</I
></TT
>
	</P
></LI
><LI
><P
><TT
CLASS="PARAMETER"
><I
>printer driver (S)</I
></TT
>
	</P
></LI
><LI
><P
><TT
CLASS="PARAMETER"
><I
>printer driver location (S)</I
></TT
>
	</P
></LI
></UL
></TD
></TR
></TABLE
></DIV
><P
>The have been two new parameters add in Samba 2.2.2 to for 
better support of Samba 2.0.x backwards capability (<TT
CLASS="PARAMETER"
><I
>disable
spoolss</I
></TT
>) and for using local printers drivers on Windows 
NT/2000 clients (<TT
CLASS="PARAMETER"
><I
>use client driver</I
></TT
>). Both of 
these options are described in the smb.coinf(5) man page and are 
disabled by default.</P
></DIV
></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="unix-permissions.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="Samba-HOWTO.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="printingdebug.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>UNIX Permission Bits and Windows NT Access Control Lists</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Debugging Printing Problems</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>