source: trunk/third/lprng/doc/Tutorial.txt @ 12500

Revision 12500, 22.9 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12499, which included commits to RCS files with non-trunk default branches.
Line 
1
2
3
4
5
6
7
8
9
10                            LLPPRRnngg TTuuttoorriiaall
11
12                _P_a_t_r_i_c_k _P_o_w_e_l_l_" _"_<_p_a_p_o_w_e_l_l_@_s_d_s_u_._e_d_u_>_"
13
14
15                               _A_B_S_T_R_A_C_T
16
17
18               This  is  a  tutorial on the installation and
19          configuration of the LPRng software.  The  various
20          _m_a_n  pages  provide  details  on each of the LPRng
21          components and should be consulted while  proceed-
22          ing  through  the  tutorial.  The following topics
23          are covered: setting up  and  testing  a  printcap
24          file;   setting   up  and  testing  authorization;
25          accounting; setting up network  databases;  debug-
26          ging problems.
27
28
29
30     11..  IInnttrroodduuccttiioonn
31
32          This  tutorial  is  an introduction to the installation
33     and testing of the LPRng software.  It assumes that you  are
34     an  oridinary  user,  and  that you have source to the LPRng
35     code.  Part of the LPRng distribution is a  _t_e_s_t  configura-
36     tion  that  allows  you to perform all of the tutorial exer-
37     cises as an ordinary user.  The  following  topics  will  be
38     covered.
39
40     1.   Setting up the TESTSUPPORT tutorial system.
41
42     2.   Basic Management Functions using LPC
43
44     3.   Creating  a printcap file for the LPRng client programs
45          such as llpprr, llppqq, and llppcc.
46
47     4.   Server (printer) printcap information and spool queues.
48
49     5.   Permissions and authorizations.
50
51     6.   Setting up a general permissions file.
52
53     7.   Setting up a per printer permissions file.
54
55     8.   Basic accounting.
56
57     22..  TTEESSTTSSUUPPPPOORRTT
58
59          A  simple  set of test and support files is provided in
60     the TESTSUPPORT directory of the LPRng distribution.   These
61
62
63
64
65
66
67
68
69
70                                  -2-
71
72
73     files,  when  processed and installed in the /tmp directory,
74     will create a simple user level printer spooler system.
75
76          LPD         - copy of spool directories
77          Makefile    - generation and installation
78          clearlog    - shell script to clear log files
79          dbserver.sh - prototype database server
80          filter.sh   - prototype shell based filter
81          lpd.conf.proto  - prototype configuration file
82          common.conf.proto   - prototype configuration file
83          lpd.perms.proto - prototype permissions file
84          main.c      - prototype C based filter
85          makedb      - database creation script
86          printcap.proto  - prototype printcap file
87
88
89          To install the files, carry out the following procedure
90     in the TESTSUPPORT directory.
91
92          CSH -
93              setenv HOST _f_u_l_l_y _q_u_a_l_i_f_i_e_d _h_o_s_t _n_a_m_e
94              setenv USER _u_s_e_r_i_d
95              setenv LPD_CONF /tmp/LPD/lpd.conf
96              path=( /tmp/LPD $path )
97
98          Bourne Shell
99              HOST=_f_u_l_l_y _q_u_a_l_i_f_i_e_d _h_o_s_t _n_a_m_e
100              USER=_u_s_e_r_i_d
101              LPD_CONF=/tmp/LPD/lpd.conf
102              export HOST USER LPD_CONF
103              PATH=/tmp/LPD:$PATH
104
105          make
106
107
108          To check that the installation was successful, the com-
109     mand lpd -D2 -F should produce output similar to the follow-
110     ing.
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                                  -3-
137
138
139          papowell@taco:70>lpd -D2 -F
140          Sep 17 16:13:17 lpd [3665]  *** Get_debug_parms ***
141          Sep 17 16:13:17 lpd [3665]  debug: 2
142          Sep 17 16:13:17 lpd [3665]  test: 0
143          Sep 17 16:13:17 lpd [3665]  remote: 0
144          Sep 17 16:13:17 lpd [3665]  log: <NULL>
145          Sep 17 16:13:17 lpd [3665]  *** <END> ***
146          Sep 17 16:13:17 lpd [3665]  main: Configuration file '/tmp/LPD/lpd.conf'
147          Sep 17 16:13:17 lpd [3665]  seteuid_wrapper: Before RUID/EUID 118/118,
148          Sep 17 16:13:17 lpd [3665]  seteuid_wrapper: After uid/euid 118/118
149          Sep 17 16:13:17 taco lpd [3665]  Getprintcap: paths '/tmp/LPD/printcap....
150          Sep 17 16:13:17 taco lpd [3665]  Printcap file '/tmp/LPD/printcap....
151          Sep 17 16:13:17 taco lpd [3665]  Get_perms: /tmp/LPD/lpd.perms.taco.sdsu.edu
152          Sep 17 16:13:17 taco lpd [3665]  Permissions file '/tmp/LPD/lpd....
153          Sep 17 16:13:17 taco Do_queue_jobs [3667]  t1: Open_log: log file log
154          Sep 17 16:13:18 taco Do_queue_jobs [3668]  t2: Open_log: log file log
155          Sep 17 16:13:19 taco Do_queue_jobs [3669]  t4: Open_log: log file log
156          ...
157
158
159     33..  LLPPQQ
160
161          The  lpq  program displays the current status of one or
162     more spool queues.
163
164     1.   In one window, start the LPD server using lpd -F.
165
166     2.   In another window, run the lpq program.  You should see
167          a status display similar to the following:
168
169     Printer: t1@taco 'Test Printer 1'
170       Queue: 9 printable jobs
171       Warning: 1 held jobs in queue
172       Server: pid 4537 active, Unspooler: pid 4538 active
173       Status: printing 'cfA637taco', sending FF after banner at 18:29:54
174       Status: printing job 'cfA637taco data file 'dfA637taco', format 'f' at 18:29:54
175       Status: printed 0% of 15 bytes at 18:29:54
176       Status: printed all 15 bytes at 18:29:54
177      Rank  Owner           Class Job Files                           Size Time
178     active papowell@taco       A 637 VERSION                           15 18:27:28
179     2      papowell@taco       A 004 VERSION                           15 18:27:27
180     3      papowell@taco       A 007 (stdin)                            5 18:27:27
181     4      papowell@taco       A 067 VERSION                           15 18:27:27
182     5      papowell@taco       A 070 VERSION                           15 18:27:27
183     6      papowell@taco       A 343 VERSION                           16 18:27:28
184     7      papowell@taco       A 672 VERSION                           15 18:27:28
185     8      papowell@taco       A 692 VERSION                           15 18:27:28
186     9      papowell@taco       A 336 VERSION                           15 18:29:55
187     hold   papowell@taco       A 335 VERSION                           15 18:27:27
188     error  papowell@taco       A 002 ERROR: cannot open '/tmp/LPD/t1/dfA003taco'
189     error  papowell@taco       A 003 ERROR: cannot open '/tmp/LPD/t1/dfA003taco'
190     error  ???@???             A 001 ERROR: empty control file 2 mins old
191
192
193
194
195
196
197
198
199
200
201
202                                  -4-
203
204
205          Try running lpq -a; this will display the status of all
206     spool queues.  The command lpq -t3 -c will display the  sta-
207     tus,  sleep  for 3 seconds, and then clear the screen before
208     redisplaying status.
209
210     44..  LLPPRR aanndd LLPPRRMM
211
212          The lpr program spools files to the  output.   Try  the
213     following commands:
214
215          echo hi | lpr
216          lpq
217
218
219     The  status  display  will  show  your spooled job.  Now try
220     spooling several jobs:
221
222          echo hi | lpr
223          echo hi | lpr
224          echo hi | lpr
225          echo hi | lpr
226          lpq
227
228
229     You can remove a spooled job by using: lprm _j_o_b_n_u_m_b_e_r.   Try
230     removing one of the jobs in the spool queue.  If you want to
231     remove all jobs, just use lprm  without  a  job  number;  by
232     default it removes all of your jobs.
233
234     55..  LLPPCC
235
236          The  lpc  program displays the current status of one or
237     more spool queues.
238
239     1.   In one window, start the LPD server using lpd -F.
240
241     2.   The lpc program can run in interactive  or  line  mode.
242          We  will  first run it in interactive mode.  In another
243          window, run the lpc program.  You should see  a  status
244          display similar to the following:
245
246               lpc >
247
248
249          Try  entering  the  help command: lpc > help; this will
250     display the help information.
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268                                  -5-
269
270
271     usage: lpc [-Ddebuglevel] [-V] [-Pprinter] [commands]
272      with no commands, reads from stdin  -Pprinter    - specify printer
273       -V           - increase information verbosity
274       -Ddebuglevel - debug level
275      commands:
276      abort   (printer[@host] | all)  - stop server
277      autohold (printer[@host] | all)  - autohold on
278      disable (printer[@host] | all)  - disable queueing
279      debug   (printer[@host] | all) debugparms - set debug level for printer
280      enable  (printer[@host] | all)  - enable  queueing
281      hold    (printer[@host] | all) (name[@host] | job | all)* - hold job
282      kill    (printer[@host] | all)  - stop and restart server
283      lpd [HUP]  - get LPD PID, signal it to reread printcap and configuration
284      lpq (printer[@host] | all) (name[@host] | job | all)*     - invoke LPQ
285      lprm (printer[@host] | all) (name[@host]|host|job| all)*  - invoke LPRM
286      noautohold (printer[@host] | all)  - autohold off
287      printcap (printer[@host] | all) - report printcap values
288      quit                            - exit LPC
289      redirect (printer[@host] | all) (printer@host | off )*    - redirect jobs
290      release  (printer[@host] | all) (name[@host] | job | all)* - release job
291      reread                          - LPD reread database information
292      start   (printer[@host] | all)  - start printing
293      status  (printer[@host] | all)  - status of printers
294      stop    (printer[@host] | all)  - stop  printing
295      topq    (printer[@host] | all) (name[@host] | job | all)* - reorder job
296
297
298          The lpc command can be used to start and stop printing,
299     spooling,  and  redirect  jobs to other queues.  By default,
300     most commands work on the currently selected printer,  which
301     is the users default printer or the last selected printer.
302
303     55..11..  SSttaattuuss RReeppoorrttss
304
305          The  status  command  can be used to show the status of
306     printers.
307
308     lpc >status all
309     Printer              Printing Spooling Jobs  Server   Slave Redirect Debug
310     t1@taco               enabled  enabled    3    none    none
311     t2@taco               enabled  enabled    0    none    none
312     t3@taco               enabled  enabled    0    none    none
313     t4@taco               enabled  enabled    0    none    none
314     t5@taco               enabled  enabled    0    none    none
315     t6@taco               enabled  enabled    0    none    none
316     t3@taco               enabled  enabled    0    none    none
317
318
319          The status display shows the name of the  printer,  its
320     print  and spooling status, the number of jobs in the queue,
321     if there is a server process active, and if there is a slave
322     process  for  the  server process.  The redirect field indi-
323     cates if the queue is  being  redirected  to  another  print
324     queue and the debug field is the current debugging level set
325
326
327
328
329
330
331
332
333
334                                  -6-
335
336
337     by the lpc command.
338
339     55..22..  SSttaarrttiinngg aanndd SSttooppppiinngg PPrriinnttiinngg aanndd SSppoooolliinngg
340
341          The _s_t_a_r_t and _s_t_o_p commands can be used  to  start  and
342     stop printing.
343
344     1.   Enter the command stop t1, status, start, and status as
345          shown below.
346
347     lpc >stop t1
348     t1 stopped
349     lpc >status
350     Printer              Printing Spooling Jobs  Server   Slave Redirect Debug
351     t1@taco              disabled  enabled    3    none    none
352     lpc >start
353     t1 started
354     lpc >status
355     Printer              Printing Spooling Jobs  Server   Slave Redirect Debug
356     t1@taco               enabled  enabled    3    none    none
357
358
359          The enable and disable commands can be used  to  enable
360     or disable spooling to the queue in a similar manner.
361
362     lpc >disable t1
363     t1 disabled
364     lpc >status
365     Printer              Printing Spooling Jobs  Server   Slave Redirect Debug
366     t1@taco               enabled disabled    3    none    none
367     lpc >enable t1
368     t1 enabled
369     lpc >status
370     Printer              Printing Spooling Jobs  Server   Slave Redirect Debug
371     t1@taco               enabled  enabled    3    none    none
372
373
374     55..33..  LLPPQQ aanndd LLPPRRMM CCoommmmaannddss
375
376          For  convenience,  the lprm and lpq commands are avail-
377     able in interactive mode.  This allows jobs  to  be  removed
378     from  a  print queue and the status of the print queue to be
379     viewed after performing commands.
380
381     55..44..  KKiilllliinngg aanndd AAbboorrttiinngg PPrriinntt QQuueeuuee
382
383          The abort and kill commands are used to kill of  print-
384     ing of a job.  The kill command will perform an abort opera-
385     tion followed by a start operation.
386
387          The abort command is useful when a job is being printed
388     and  needs  to  be  restarted, but at a later time using the
389     start command.  The kill command is useful when a job can be
390     immediately restarted.
391
392
393
394
395
396
397
398
399
400                                  -7-
401
402
403     55..55..  TTOOPPQQ -- CChhaannggiinngg jjoobb pprriioorriittyy
404
405          The topq command can be used to reorder the priority of
406     user jobs.  Jobs that have their priority  altered  will  be
407     printed  before  jobs  that  have not.  Updated jobs will be
408     printed in last updated, first out order.
409
410          For example, the command topq root will have all of the
411     root  users jobs printed first, starting with the oldest job
412     in the queue.
413
414     55..66..  HHoolldd,, AAuuttoohhoolldd,, aanndd RReelleeaassee
415
416          The hold, autohold, noautohold,  and  release  commands
417     are  used  to  temporarily prevent a job from being printed.
418     The hold command is used to hold a job and the release  com-
419     mand to release it.
420
421          The autohold option can be enabled in the printcap file
422     using the :ah: printcap field.  If autohold is enabled, then
423     all  jobs will be held until released using the release com-
424     mand.  The interactive autohold command can be used to over-
425     ride  the  printcap information.  The status of the autohold
426     option is recorded in the spool queue control file and  will
427     persist  over  system  restarts.  Autohold can be turned off
428     using the noautohold command.
429
430          When a job is released  the  printer  may  need  to  be
431     started if it is disabled.
432
433     55..77..  JJoobb aanndd QQuueeuuee RReeddiirreeccttiioonn
434
435          The  move  and  redirect commands are used to move jobs
436     between different queues.
437
438          The move command will move a selected set of jobs to  a
439     new  queue.   For  example, move t1 root t2 will move all of
440     the jobs on printer t1 submitted by root to the t2  printer.
441
442          The redirect command will cause all jobs submitted to a
443     particular spool queue to be forwarded to the  new  printer.
444     The redirect off command will turn redirection off.
445
446     55..88..  DDiiaaggnnoossttiicc CCoommmmaannddss -- ddeebbuugg,, llppdd,, rreerreeaadd,, pprriinnttccaapp
447
448          The  debug,  lpd,  and  lpq  commands are available for
449     diagnostic purposes.
450
451          The debug command allows the adminstrator to set debug-
452     ging information and values for a specific spool queue.  For
453     example, debug 7,remote=5,log=/tmp/x would set debugging  to
454     level 7, the remote flag to 5, and send debugging log infor-
455     mation to the  /tmp/x  file.   The  debug  command  with  no
456     options will turn all debugging options off.
457
458
459
460
461
462
463
464
465
466                                  -8-
467
468
469          The  lpd command will print the process ID (PID) of the
470     LPD server process.  The  reread  command  will  send  it  a
471     SIGHUP signal, causing it to reread the various databases.
472
473          The  printcap command will cause the printcap entry for
474     the specified printer to be returned.  This is  useful  when
475     trying  to  determine  the actual values of a printcap entry
476     being used by the LPRng software.
477
478     66..  CCoommmmaanndd LLiinnee IInntteerrffaaccee
479
480          The command line interface is identical to the interac-
481     tive  interface,  but  only  allows  a  single command to be
482     entered at a time.  For example: lpc status all  will  print
483     the status of all the printers, and lpc start all will start
484     all printers.
485
486     77..  LLPPRRMM
487
488          The lprm program is used to remove jobs from the  spool
489     queues.   For  the  following exercises, we will temporarily
490     stop printing, and submit jobs.
491
492     1.   In one window, start the LPD server using lpd -F.
493
494     2.   Temporarily stop printing for all spool queues.
495
496               lpc stop all
497
498
499     3.   Submit a set of jobs to a printer.
500
501               echo hi |lpr -Pt1
502               echo hi |lpr -Pt1
503
504
505     4.   Display the queue status using lpq -a.
506
507               Printer: t1@taco 'Test Printer 1' (printing disabled)
508                 Queue: 5 printable jobs
509                 Warning: no server present
510                 Status: finished operations at Sun Mar  3 13:51:49 1996
511                Rank  Owner           Class Job Files                           Size Time
512               1      papowell@taco       A 050 (stdin)                            3 13:53:39
513               2      papowell@taco       A 068 (stdin)                            3 13:55:41
514               3      papowell@taco       A 075 (stdin)                            3 13:55:46
515
516
517     5.   Try removing one of the jobs using lprm _j_o_b_n_u_m_b_e_r;  for
518          example lprm 050.
519
520     6.   Try using lprm _u_s_e_r_n_a_m_e to remove all jobs submitted by
521          a particular user.
522
523
524
525
526
527
528
529
530
531
532                                  -9-
533
534
535     7.   If you want to remove all jobs in a queue and you  have
536          control permissions on the queue, you can use lprm all.
537
538     8.   The -a (all) option will try to  remove  the  specified
539          jobs  from all printers.  Try lprm -a all to remove all
540          jobs for all users.
541
542     88..  PPrriinnttccaappss aanndd CCHHEECCKKPPCC
543
544          The checkpc program can be used  to  validate  printcap
545     entries and to set permissions and ownerships on the various
546     printcap  files.   The  following  is  a  set  of  exercises
547     intended to show the use of the checkpc program.
548
549     9.   Stop  the  lpd  server  by sending it a kill signal.  A
550          quick method of doing this is:
551
552               kill `ps -aux |grep lpd | awk '{print $2 }'`
553
554
555     10.  Run the checkpc program.  The following is typical out-
556          put.
557
558                LPRng version LPRng-2.2.0
559                Get_perms: permissions file '/tmp/LPD/lpd.perms.taco.sdsu.edu'
560                Printcap file '/tmp/LPD/printcap.taco.sdsu.edu'
561                Printcap file '/tmp/LPD/lpd_printcap.taco.sdsu.edu'
562                LPD lockfile '/tmp/LPD/lpd.lock.taco.sdsu.edu'
563                  checking file '/tmp/LPD/lpd.lock.taco.sdsu.edu'
564                t1: Checking printcap entry 't1'
565                t1:   checking file '/tmp/LPD/t1/control.t1'
566                t1:   checking file '/tmp/LPD/t1/status.t1'
567                t1:   checking file '/tmp/LPD/t1/log'
568                t1:   checking file '/tmp/LPD/t1/accnt'
569               checkpc: Warning - permissions of '/tmp/LPD/t1/cfA001taco' are 0644, not 0600
570                t1: Checking log file '/tmp/LPD/t1/log'
571                t1:    log file 12060 bytes long: no truncation
572
573
574     11.  Now  try  using  the -f (fix) option to set permissions
575          and ownership.
576
577               checkpc -f
578
579
580          Permissions and ownership will be corrected.
581
582     12.  As the lpd server executes, it  will  put  output  into
583          log,  status,  and accounting files in the spool direc-
584          tory.  The checkpc -t _s_i_z_e command will truncate  these
585          files  to _s_i_z_e bytes.  For example, checkpc -t 2k trun-
586          cate these files to less than 2K bytes.  Use this  com-
587          mand to truncate the log files.
588
589
590
591
592
593
594
595
596
597
598                                 -10-
599
600
601     99..  llppdd..ppeerrmmss FFiillee aanndd  PPeerrmmiissssiioonnss
602
603          The  lpd server uses the lpd.perms file to control user
604     access to services.  The following is an example permissions
605     file.
606
607          # Sample permissions file
608          DEFAULT ACCEPT
609          # Root on server can do control operations
610          ACCEPT SERVICE=C SERVER USER=root
611          # The specified user on the server can do control operations
612          ACCEPT SERVICE=C SERVER USER=_u_s_e_r
613          # Do not allow any other users to do control operations
614          REJECT SERVICE=C
615          # Job Removal can be done by the same user on the originating host
616          ACCEPT SERVICE=M SAMEHOST SAMEUSER
617          # Also by root on the server
618          ACCEPT SERVICE=M SERVER USER=root
619          # Reject all other requests
620          REJECT SERVICE=M
621          # Reject requests from subnet 130.191.25.0 (24 bit Subnet mask)
622          REJECT IP=130.191.25.0/255.255.255.0
623          # or REJECT IP=130.191.25.0/24
624          # Printer t1: Accept all requests
625          PRINTER=t1 ACCEPT
626
627
628          The man page for lpd.perms.  has a detailed description
629     of the various fields and entries.  Each line in the permis-
630     sions  file  is  a  test  that  is performed against various
631     information associated with a user request.  The  tests  are
632     applied  in  sequence  until a match is found; the ACCEPT or
633     REJECT keyword specifies  of  the  request  is  accepted  or
634     rejected.
635
636          The  DEFAULT keyword specifies the default action if no
637     explicit match is found.
638
639          In addition to the main permissions  file,  each  spool
640     queue  can  have an additional set of permissions tests that
641     can be applied to requests that have been  accepted  by  the
642     main permissions file.
643
644          The  SERVICE  tag specifies the type of service for the
645     match.  Note that not all service  requests  have  the  same
646     amount  of  information to be tested.  This is a consequence
647     of the protocol used to send requests  to  the  server.   In
648     addition,  the X (connection) request is applied to all con-
649     nections, and can be used to restrict  requests  to  only  a
650     limited range of host systems.
651
652          When constructing a permissions file, the most specific
653     tests should be applied first, then the most  general.   The
654     REJECT  tests should precede the ACCEPT, and a default for a
655
656
657
658
659
660
661
662
663
664                                 -11-
665
666
667     particular action should immediately  follow.   Here  are  a
668     suggested set of exerises for the reader.
669
670     13.  Modify  the permissions file so that print requests and
671          job from user are rejected.  Answer:
672
673               REJECT SERVICE=R,P USER=_u_s_e_r
674
675
676     14.  Modify the permissions file to allow only hosts in  the
677          IP  address submask 130.191.130.0/255.255.255.0 to have
678          access.  Answer:
679
680               REJECT SERVICE=X NOT IP=130.191.130.0/255.255.255
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
Note: See TracBrowser for help on using the repository browser.