| 1 | <?xml version = '1.0' encoding = 'UTF-8'?> |
1 | <?xml version = '1.0' encoding = 'UTF-8'?> |
| 2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 3 | <guide link="quick-samba-howto.xml"> |
3 | <guide link="quick-samba-howto.xml"> |
| 4 | <title>Gentoo Samba3/CUPS/clamav HOWTO</title> |
4 | <title>Gentoo Samba3/CUPS/Clam AV HOWTO</title> |
| 5 | <author title="Author"> |
5 | <author title="Author"> |
| 6 | <mail link="daff at dword dot org">Andreas "daff" Ntaflos</mail> |
6 | <mail link="daff at dword dot org">Andreas "daff" Ntaflos</mail> |
| 7 | </author> |
7 | </author> |
| 8 | <author title="Author"> |
8 | <author title="Author"> |
| 9 | <mail link="joshua@sungentoo.homeunix.com">Joshua Preston</mail> |
9 | <mail link="joshua@sungentoo.homeunix.com">Joshua Preston</mail> |
| 10 | </author> |
10 | </author> |
| 11 | |
11 | |
| 12 | <abstract> |
12 | <abstract> |
| 13 | Setup, install and configure a Samba Server under Gentoo that shares |
13 | Setup, install and configure a Samba Server under Gentoo that shares |
| 14 | files, printers without the need to install drivers and provides |
14 | files, printers without the need to install drivers and provides |
| 15 | automatic virus scanning. |
15 | automatic virus scanning. |
| 16 | </abstract> |
16 | </abstract> |
| 17 | |
17 | |
| 18 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
18 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
| 19 | <!-- See http://creativecommons.org/licenses/by-sa/1.0 --> |
19 | <!-- See http://creativecommons.org/licenses/by-sa/1.0 --> |
| 20 | <license/> |
20 | <license/> |
| 21 | |
21 | |
| 22 | <version>1.2</version> |
22 | <version>1.3</version> |
| 23 | <date>May 13, 2004</date> |
23 | <date>May 18, 2004</date> |
| 24 | |
24 | |
| 25 | <chapter> |
25 | <chapter> |
| 26 | <title>Introduction to this HOWTO</title> |
26 | <title>Introduction to this HOWTO</title> |
| 27 | <section> |
27 | <section> |
| 28 | <title>Purpose</title> |
28 | <title>Purpose</title> |
| 29 | <body> |
29 | <body> |
| 30 | |
30 | |
| 31 | <p> |
31 | <p> |
| 32 | This HOWTO is designed to help you move a network from many different |
32 | This HOWTO is designed to help you move a network from many different |
| 33 | clients speaking different languages, to many different manchines that |
33 | clients speaking different languages, to many different manchines that |
| 34 | speak a common language. The ultimate goal is to help differing |
34 | speak a common language. The ultimate goal is to help differing |
| 35 | architechures and technologies, come together in a productive, |
35 | architectures and technologies, come together in a productive, |
| 36 | happily coexistant environment. |
36 | happily coexisting environment. |
| 37 | </p> |
37 | </p> |
| 38 | |
38 | |
| 39 | <p> |
39 | <p> |
| 40 | Following the directions outlined in this HOWTO should give you an |
40 | Following the directions outlined in this HOWTO should give you an |
| 41 | excellent step towards a peaceful cohabitation between Windows, and |
41 | excellent step towards a peaceful cohabitation between Windows, and |
| 42 | virtually all known variations of *nix. |
42 | virtually all known variations of *nix. |
| 43 | </p> |
43 | </p> |
| 44 | |
44 | |
| 45 | <p> |
45 | <p> |
| 46 | This HOWTO originally started not as a HOWTO, but as a FAQ. It was |
46 | This HOWTO originally started not as a HOWTO, but as a FAQ. It was |
| 47 | intended to explore the functionality and power of the Gentoo system, |
47 | intended to explore the functionality and power of the Gentoo system, |
| 48 | portage and the flexibility of USE flags. Like so many other projects, |
48 | portage and the flexibility of USE flags. Like so many other projects, |
| 49 | it was quickly discovered what was missing in the Gentoo realm: there |
49 | it was quickly discovered what was missing in the Gentoo realm: there |
| 50 | weren't any Samba HOWTO's catered for Gentoo users. These users are |
50 | weren't any Samba HOWTO's catered for Gentoo users. These users are |
| 51 | more demanding than most; they require performance, flexibility and |
51 | more demanding than most; they require performance, flexibility and |
| … | |
… | |
| 299 | </li> |
299 | </li> |
| 300 | </ul> |
300 | </ul> |
| 301 | |
301 | |
| 302 | </body> |
302 | </body> |
| 303 | </section> |
303 | </section> |
| 304 | </chapter> |
304 | </chapter> |
| 305 | <chapter> |
305 | <chapter> |
| 306 | <title>Server Software Installation</title> |
306 | <title>Server Software Installation</title> |
| 307 | <section> |
307 | <section> |
| 308 | <title>Emerging Samba</title> |
308 | <title>Emerging Samba</title> |
| 309 | <body> |
309 | <body> |
| 310 | |
310 | |
| 311 | <p> |
311 | <p> |
| 312 | First of all: be sure that all your hostnames resolve correctly. |
312 | First of all: be sure that all your hostnames resolve correctly. |
| 313 | Either have a working domain name system running on your network |
313 | Either have a working domain name system running on your network |
| 314 | or appropriate entries in your /etc/hosts file. cupsaddsmb often |
314 | or appropriate entries in your <path>/etc/hosts</path> file. |
| 315 | borks if hostnames don't point to the correct machines. |
315 | <c>cupsaddsmb</c> often borks if hostnames don't point to the correct |
|
|
316 | machines. |
| 316 | </p> |
317 | </p> |
| 317 | |
318 | |
| 318 | <p> |
319 | <p> |
| 319 | Hopefully now you can make an assessment of what you'll actually need in |
320 | Hopefully now you can make an assessment of what you'll actually need in |
| 320 | order to use Samba with your particular setup. The setup used for this |
321 | order to use Samba with your particular setup. The setup used for this |
| 321 | HOWTO is: |
322 | HOWTO is: |
| 322 | </p> |
323 | </p> |
| 323 | |
324 | |
| 324 | <ul> |
325 | <ul> |
| 325 | <li>oav</li> |
326 | <li>oav</li> |
| 326 | <li>cups</li> |
327 | <li>cups</li> |
| 327 | <li>readline</li> |
328 | <li>readline</li> |
| 328 | <li>pam</li> |
329 | <li>pam</li> |
| 329 | </ul> |
330 | </ul> |
| 330 | |
331 | |
| … | |
… | |
| 338 | # <i>USE="oav readline cups pam -python -ldap -kerberos -xml -acl -mysql" emerge net-fs/samba</i> |
339 | # <i>USE="oav readline cups pam -python -ldap -kerberos -xml -acl -mysql" emerge net-fs/samba</i> |
| 339 | </pre> |
340 | </pre> |
| 340 | |
341 | |
| 341 | <note> |
342 | <note> |
| 342 | The following archs will need to add <e>~</e> to their <e>KEYWORDS</e>: x86, |
343 | The following archs will need to add <e>~</e> to their <e>KEYWORDS</e>: x86, |
| 343 | ppc, sparc, hppa, ia64 and alpha |
344 | ppc, sparc, hppa, ia64 and alpha |
| 344 | </note> |
345 | </note> |
| 345 | |
346 | |
| 346 | <p> |
347 | <p> |
| 347 | This will emerge Samba and CUPS (if CUPS is not already emerged). |
348 | This will emerge Samba and CUPS (if CUPS is not already emerged). |
| 348 | </p> |
349 | </p> |
| 349 | |
350 | |
| 350 | </body> |
351 | </body> |
| 351 | </section> |
352 | </section> |
| 352 | <section> |
353 | <section> |
| 353 | <title>Emerging clam-av</title> |
354 | <title>Emerging Clam AV</title> |
| 354 | <body> |
355 | <body> |
| 355 | |
356 | |
| 356 | <p> |
357 | <p> |
| 357 | Because the oav USE flag only provides an interface to allow on access |
358 | Because the <e>oav</e> USE flag only provides an interface to allow on access |
| 358 | virus scanning, the actual virus scanner must be emerged. The scanner |
359 | virus scanning, the actual virus scanner must be emerged. The scanner |
| 359 | used in this HOWTO is <e>net-mail/clamav</e>. |
360 | used in this HOWTO is Clam AV. |
| 360 | </p> |
361 | </p> |
| 361 | |
362 | |
| 362 | <pre caption="Emerge clam-av"> |
363 | <pre caption="Emerge clam-av"> |
| 363 | # <i>emerge net-mail/clamav</i> |
364 | # <i>emerge net-mail/clamav</i> |
| 364 | </pre> |
365 | </pre> |
| 365 | |
366 | |
| 366 | </body> |
367 | </body> |
| 367 | </section> |
368 | </section> |
| 368 | <section> |
369 | <section> |
| 369 | <title>Emerging foomatic</title> |
370 | <title>Emerging foomatic</title> |
| 370 | <body> |
371 | <body> |
| 371 | |
372 | |
| 372 | <pre caption="Emerge foomatic"> |
373 | <pre caption="Emerge foomatic"> |
| 373 | # <i>emerge net-print/foomatic</i> |
374 | # <i>emerge net-print/foomatic</i> |
| 374 | </pre> |
375 | </pre> |
| … | |
… | |
| 389 | |
390 | |
| 390 | </body> |
391 | </body> |
| 391 | </section> |
392 | </section> |
| 392 | </chapter> |
393 | </chapter> |
| 393 | <chapter> |
394 | <chapter> |
| 394 | <title>Server Configuration</title> |
395 | <title>Server Configuration</title> |
| 395 | <section> |
396 | <section> |
| 396 | <title>Configuring Samba</title> |
397 | <title>Configuring Samba</title> |
| 397 | <body> |
398 | <body> |
| 398 | |
399 | |
| 399 | <p> |
400 | <p> |
| 400 | The main Samba configuration file is <path>/etc/samba/smb.conf</path>. |
401 | The main Samba configuration file is <path>/etc/samba/smb.conf</path>. |
| 401 | It is divided in sections indicated by [sectionname]. Comments are either |
402 | It is divided in sections indicated by [sectionname]. Comments are either |
| 402 | # or ;. A sample <path>smb.conf</path> is included below with comments and |
403 | # or ;. A sample <path>smb.conf</path> is included below with comments and |
| 403 | suggestions for modifications. If more details are required, see the |
404 | suggestions for modifications. If more details are required, see the |
| 404 | man page for <path>smb.conf</path>, the installed smb.conf.example, the Samba |
405 | man page for <path>smb.conf</path>, the installed |
| 405 | Web site or any of the numerous Samba books available. |
406 | <path>smb.conf.example</path>, the Samba Web site or any of the |
|
|
407 | numerous Samba books available. |
| 406 | </p> |
408 | </p> |
| 407 | |
409 | |
| 408 | <pre caption="A Sample /etc/samba/smb.conf"> |
410 | <pre caption="A Sample /etc/samba/smb.conf"> |
| 409 | [global] |
411 | [global] |
| 410 | <comment># Replace MYWORKGROUPNAME with your workgroup/domain</comment> |
412 | <comment># Replace MYWORKGROUPNAME with your workgroup/domain</comment> |
| 411 | workgroup = <comment>MYWORKGROUPNAME</comment> |
413 | workgroup = <comment>MYWORKGROUPNAME</comment> |
| 412 | <comment># Of course this has no REAL purpose other than letting |
414 | <comment># Of course this has no REAL purpose other than letting |
| 413 | # everyone know its not Windows! |
415 | # everyone know its not Windows! |
| 414 | # %v prints the version of Samba we are using.</comment> |
416 | # %v prints the version of Samba we are using.</comment> |
| 415 | server string = Samba Server %v |
417 | server string = Samba Server %v |
| 416 | <comment># We are going to use cups, so we are going to put it in here ;-)</comment> |
418 | <comment># We are going to use cups, so we are going to put it in here ;-)</comment> |
| 417 | printcap name = cups |
419 | printcap name = cups |
| 418 | printing = cups |
420 | printing = cups |
| 419 | load printers = yes |
421 | load printers = yes |
| 420 | <comment># We want a log file and we do not want it to get bigger than 50kb.</comment> |
422 | <comment># We want a log file and we do not want it to get bigger than 50kb.</comment> |
| … | |
… | |
| 481 | # be the only printer admin)</comment> |
483 | # be the only printer admin)</comment> |
| 482 | printer admin = <i>root</i> |
484 | printer admin = <i>root</i> |
| 483 | |
485 | |
| 484 | <comment># We create a new share that we can read/write to from anywhere |
486 | <comment># We create a new share that we can read/write to from anywhere |
| 485 | # This is kind of like a public temp share, anyone can do what |
487 | # This is kind of like a public temp share, anyone can do what |
| 486 | # they want here.</comment> |
488 | # they want here.</comment> |
| 487 | [public] |
489 | [public] |
| 488 | comment = Public Files |
490 | comment = Public Files |
| 489 | browseable = yes |
491 | browseable = yes |
| 490 | public = yes |
492 | public = yes |
| 491 | create mode = 0766 |
493 | create mode = 0766 |
| 492 | guest ok = yes |
494 | guest ok = yes |
| 493 | path = /home/samba/public |
495 | path = /home/samba/public |
| 494 | </pre> |
496 | </pre> |
| 495 | |
497 | |
| 496 | <p> |
498 | <warn> |
| 497 | There are several warnings that we should put here: |
|
|
| 498 | </p> |
|
|
| 499 | |
499 | |
| 500 | <ul> |
|
|
| 501 | <li> |
|
|
| 502 | If you like to use Samba's guest account to do anything concerning |
500 | If you like to use Samba's guest account to do anything concerning |
| 503 | printing from Windows clients: don't |
501 | printing from Windows clients: don't set <c>guest only = yes</c> in |
| 504 | </li> |
502 | the <c>[global]</c> section. The guest account seems to cause |
| 505 | <li>Don't set guest only = yes in the global section</li> |
503 | problems when running <c>cupsaddsmb</c> sometimes when trying to |
| 506 | <li> |
|
|
| 507 | The guest account seems to cause problems when running cupsaddsmb sometimes |
|
|
| 508 | when trying to connect from Windows machines. See below, too, when we talk |
504 | connect from Windows machines. See below, too, when we talk about |
| 509 | about cupsaddsmb and the problems that can arise. Use a dedicated printer |
505 | <c>cupsaddsmb</c> and the problems that can arise. Use a dedicated |
| 510 | user, like "printeruser" or "printer" or "printme" or whatever. It doesn't |
506 | printer user, like <c>printeruser</c> or <c>printer</c> or |
| 511 | hurt and it will certainly protect you from a lot of problems. |
507 | <c>printme</c> or whatever. It doesn't hurt and it will certainly |
| 512 | </li> |
508 | protect you from a lot of problems. |
| 513 | </ul> |
509 | </warn> |
| 514 | |
510 | |
| 515 | <p> |
511 | <p> |
| 516 | Now create the directories required for the minimum configuration of |
512 | Now create the directories required for the minimum configuration of |
| 517 | Samba to share the installed printer throughout the network. |
513 | Samba to share the installed printer throughout the network. |
| 518 | </p> |
514 | </p> |
| 519 | |
515 | |
| 520 | <pre caption="Create the directories"> |
516 | <pre caption="Create the directories"> |
| 521 | # <i>mkdir /etc/samba/printer</i> |
517 | # <i>mkdir /etc/samba/printer</i> |
| 522 | # <i>mkdir /var/spool/samba</i> |
518 | # <i>mkdir /var/spool/samba</i> |
| 523 | # <i>mkdir /home/samba/public</i> |
519 | # <i>mkdir /home/samba/public</i> |
| 524 | </pre> |
520 | </pre> |
| 525 | |
521 | |
| 526 | <p> |
522 | <p> |
| 527 | At least one Samba user is required in order to install the printer |
523 | At least one Samba user is required in order to install the printer |
| 528 | drivers and to allow users to connect to the printer. Users must |
524 | drivers and to allow users to connect to the printer. Users must |
| … | |
… | |
| 532 | <pre caption="Creating the users"> |
528 | <pre caption="Creating the users"> |
| 533 | # <i>smbpasswd -a root</i> |
529 | # <i>smbpasswd -a root</i> |
| 534 | |
530 | |
| 535 | <comment>(If another user is to be a printer admin)</comment> |
531 | <comment>(If another user is to be a printer admin)</comment> |
| 536 | # <i>smbpasswd -a username</i> |
532 | # <i>smbpasswd -a username</i> |
| 537 | </pre> |
533 | </pre> |
| 538 | |
534 | |
| 539 | <p> |
535 | <p> |
| 540 | The Samba passwords need not be the same as the system passwords |
536 | The Samba passwords need not be the same as the system passwords |
| 541 | in <path>/etc/passwd</path>. |
537 | in <path>/etc/passwd</path>. |
| 542 | </p> |
538 | </p> |
| 543 | |
539 | |
| 544 | </body> |
540 | </body> |
| 545 | </section> |
541 | </section> |
| 546 | <section> |
542 | <section> |
| 547 | <title>Configuring clam-av</title> |
543 | <title>Configuring Clam AV</title> |
| 548 | <body> |
544 | <body> |
| 549 | |
545 | |
| 550 | <p> |
546 | <p> |
| 551 | The configuration file specified to be used in <path>smb.conf</path> is |
547 | The configuration file specified to be used in <path>smb.conf</path> is |
| 552 | <path>/etc/samba/vscan-clamav.conf</path>. While these options are set |
548 | <path>/etc/samba/vscan-clamav.conf</path>. While these options are set |
| 553 | to the defaults, the infected file action may need to be changed. |
549 | to the defaults, the infected file action may need to be changed. |
| 554 | </p> |
550 | </p> |
| 555 | |
551 | |
| 556 | <pre caption="/etc/samba/vscan-clamav.conf"> |
552 | <pre caption="/etc/samba/vscan-clamav.conf"> |
| 557 | [samba-vscan] |
553 | [samba-vscan] |
| 558 | <comment>; run-time configuration for vscan-samba using |
554 | <comment>; run-time configuration for vscan-samba using |
| 559 | ; clamd |
555 | ; clamd |
| 560 | ; all options are set to default values</comment> |
556 | ; all options are set to default values</comment> |
| 561 | |
557 | |
| 562 | <comment>; do not scan files larger than X bytes. If set to 0 (default), |
558 | <comment>; do not scan files larger than X bytes. If set to 0 (default), |
| … | |
… | |
| 603 | ; of period, samba-vscan use a last recently used file mechanism to avoid |
599 | ; of period, samba-vscan use a last recently used file mechanism to avoid |
| 604 | ; multiple scans of a file. This setting specified the maximum number of |
600 | ; multiple scans of a file. This setting specified the maximum number of |
| 605 | ; elements of the last recently used file list. (default: 100)</comment> |
601 | ; elements of the last recently used file list. (default: 100)</comment> |
| 606 | max lru files entries = 100 |
602 | max lru files entries = 100 |
| 607 | |
603 | |
| 608 | <comment>; an entry is invalidad after lru file entry lifetime (in seconds). |
604 | <comment>; an entry is invalidad after lru file entry lifetime (in seconds). |
| 609 | ; (Default: 5)</comment> |
605 | ; (Default: 5)</comment> |
| 610 | lru file entry lifetime = 5 |
606 | lru file entry lifetime = 5 |
| 611 | |
607 | |
| 612 | <comment>; socket name of clamd (default: /var/run/clamd)</comment> |
608 | <comment>; socket name of clamd (default: /var/run/clamd)</comment> |
| 613 | clamd socket name = /var/run/clamd |
609 | clamd socket name = /var/run/clamd |
| 614 | </pre> |
610 | </pre> |
| 615 | |
611 | |
| 616 | <p> |
612 | <p> |
| 617 | It is generally a good idea to start the virus scanner immediately. Add |
613 | It is generally a good idea to start the virus scanner immediately. Add |
| 618 | it to the default runlevel and then start the clamd service immediately. |
614 | it to the <e>default</e> runlevel and then start the <c>clamd</c> service immediately. |
| 619 | </p> |
615 | </p> |
| 620 | |
616 | |
| 621 | <pre caption="Add clamd to bootup and start it"> |
617 | <pre caption="Add clamd to bootup and start it"> |
| 622 | # <i>rc-update add clamd default</i> |
618 | # <i>rc-update add clamd default</i> |
| 623 | # <i>/etc/init.d/clamd start</i> |
619 | # <i>/etc/init.d/clamd start</i> |
| 624 | </pre> |
620 | </pre> |
| 625 | |
621 | |
| 626 | </body> |
622 | </body> |
| 627 | </section> |
623 | </section> |
| 628 | <section> |
624 | <section> |
| 629 | <title>Configuring CUPS</title> |
625 | <title>Configuring CUPS</title> |
| 630 | <body> |
626 | <body> |
| 631 | |
627 | |
| 632 | <p> |
628 | <p> |
| 633 | This is a little more complicated). CUPS' main config file is |
629 | This is a little more complicated. CUPS' main config file is |
| 634 | <path>/etc/cups/cupsd.conf</path>. It's structure is similar to Apache's |
630 | <path>/etc/cups/cupsd.conf</path>. It's structure is similar to Apache's |
| 635 | <path>httpd.conf</path> file, so many you may find it familiar. Outlined |
631 | <path>httpd.conf</path> file, so many you may find it familiar. Outlined |
| 636 | in the example are the directives that need to be changed: |
632 | in the example are the directives that need to be changed: |
| 637 | </p> |
633 | </p> |
| 638 | |
634 | |
| 639 | <pre caption="/etc/cups/cupsd.conf"> |
635 | <pre caption="/etc/cups/cupsd.conf"> |
| 640 | ServerName <i>PrintServer</i> <comment># your printserver name</comment> |
636 | ServerName <i>PrintServer</i> <comment># your printserver name</comment> |
| 641 | ServerAdmin <i>root@PrintServer</i> <comment># the person for printer-related hate-mail, eg you</comment> |
637 | ServerAdmin <i>root@PrintServer</i> <comment># the person for printer-related hate-mail, eg you</comment> |
| 642 | |
638 | |
| 643 | AccessLog /var/log/cups/access_log <comment># probably doesn't need changing</comment> |
639 | AccessLog /var/log/cups/access_log <comment># probably doesn't need changing</comment> |
| 644 | ErrorLog /var/log/cups/error_log <comment># doesn't really need changing either</comment> |
640 | ErrorLog /var/log/cups/error_log <comment># doesn't really need changing either</comment> |
| 645 | |
641 | |
| 646 | LogLevel debug <comment># only while isntalling and testing, should later be |
642 | LogLevel debug <comment># only while isntalling and testing, should later be |
| 647 | # changed to 'info'</comment> |
643 | # changed to 'info'</comment> |
| 648 | |
644 | |
| … | |
… | |
| 662 | </Location> |
658 | </Location> |
| 663 | |
659 | |
| 664 | <Location /admin> |
660 | <Location /admin> |
| 665 | AuthType Basic |
661 | AuthType Basic |
| 666 | AuthClass System |
662 | AuthClass System |
| 667 | Allow From <i>192.168.1.*</i> <comment># same as above, allow any host on the |
663 | Allow From <i>192.168.1.*</i> <comment># same as above, allow any host on the |
| 668 | # 192.168.1.0 network to connect and do |
664 | # 192.168.1.0 network to connect and do |
| 669 | # administrative tasks after authenticating</comment> |
665 | # administrative tasks after authenticating</comment> |
| 670 | Order Deny,Allow |
666 | Order Deny,Allow |
| 671 | Deny From All |
667 | Deny From All |
| 672 | </Location> |
668 | </Location> |
| 673 | </pre> |
669 | </pre> |
| 674 | |
670 | |
| 675 | <p> |
671 | <p> |
| 676 | Edit <path>/etc/cups/mime.convs</path> to uncomment some lines. |
672 | Edit <path>/etc/cups/mime.convs</path> to uncomment some lines. |
| 677 | The changes to mime.convs and mime.types are needed to make CUPSprint Microsoft Office document files. |
673 | The changes to <path>mime.convs</path> and <path>mime.types</path> are |
|
|
674 | needed to make CUPS print Microsoft Office document files. |
| 678 | </p> |
675 | </p> |
| 679 | |
676 | |
| 680 | <pre caption="/etc/cups/mime.convs"> |
677 | <pre caption="/etc/cups/mime.convs"> |
| 681 | <comment>(The following line is found near the end of the file. Uncomment it)</comment> |
678 | <comment>(The following line is found near the end of the file. Uncomment it)</comment> |
| 682 | application/octet-stream application/vnd.cups-raw 0 |
679 | application/octet-stream application/vnd.cups-raw 0 |
| 683 | </pre> |
680 | </pre> |
| 684 | |
681 | |
| 685 | <p> |
682 | <p> |
| 686 | Edit <path>/etc/cups/mime.convs</path> to uncomment some lines. |
683 | Edit <path>/etc/cups/mime.convs</path> to uncomment some lines. |
| 687 | </p> |
684 | </p> |
| 688 | |
685 | |
| 689 | <pre caption="/etc/cups/mime.types"> |
686 | <pre caption="/etc/cups/mime.types"> |
| 690 | <comment>(The following line is found near the end of the file. Uncomment it)</comment> |
687 | <comment>(The following line is found near the end of the file. Uncomment it)</comment> |
| 691 | application/octet-stream |
688 | application/octet-stream |
| 692 | </pre> |
689 | </pre> |
| … | |
… | |
| 714 | First, go to <uri link="http://linuxprinting.org">LinuxPrinting.Org</uri> |
711 | First, go to <uri link="http://linuxprinting.org">LinuxPrinting.Org</uri> |
| 715 | to find and download the correct PPD file for your printer and CUPS. To |
712 | to find and download the correct PPD file for your printer and CUPS. To |
| 716 | do so, click the link Printer Listings to the left. Select your |
713 | do so, click the link Printer Listings to the left. Select your |
| 717 | printers manufacturer and the model in the pulldown menu, eg HP and |
714 | printers manufacturer and the model in the pulldown menu, eg HP and |
| 718 | DeskJet 930C. Click "Show". On the page coming up click the "recommended |
715 | DeskJet 930C. Click "Show". On the page coming up click the "recommended |
| 719 | driver" link after reading the various notes and information. Then fetch |
716 | driver" link after reading the various notes and information. Then fetch |
| 720 | the PPD file from the next page, again after reading the notes and |
717 | the PPD file from the next page, again after reading the notes and |
| 721 | introductions there. You may have to select your printers manufacturer |
718 | introductions there. You may have to select your printers manufacturer |
| 722 | and model again. Reading the <uri link="http://www.linuxprinting.org/cups-doc.html">CUPS |
719 | and model again. Reading the <uri link="http://www.linuxprinting.org/cups-doc.html">CUPS |
| 723 | quickstart guide</uri> is also very helpful when working with CUPS. |
720 | quickstart guide</uri> is also very helpful when working with CUPS. |
| 724 | </p> |
721 | </p> |
| 725 | |
722 | |
| 726 | <p> |
723 | <p> |
| 727 | Now you have a PPD file for your printer to work with CUPS. Place it in |
724 | Now you have a PPD file for your printer to work with CUPS. Place it in |
| 728 | <path>/usr/share/cups/model</path>. The PPD for the HP DeskJet 930C was |
725 | <path>/usr/share/cups/model</path>. The PPD for the HP DeskJet 930C was |
| 729 | named HP-DeskJet_930C-hpijs.ppd. You should now install the printer. |
726 | named <path>HP-DeskJet_930C-hpijs.ppd</path>. You should now install the printer. |
| 730 | This can be done via the CUPS web interface or via command line. The web |
727 | This can be done via the CUPS web interface or via command line. The web |
| 731 | interface is found at http://PrintServer:631 once CUPS is running. |
728 | interface is found at <path>http://PrintServer:631</path> once CUPS is running. |
| 732 | </p> |
729 | </p> |
| 733 | |
730 | |
| 734 | <pre caption="Install the printer via command line"> |
731 | <pre caption="Install the printer via command line"> |
| 735 | # <i>lpadmin -p HPDeskJet930C -E -v usb:/dev/ultp0 -m HP-DeskJet_930C-hpijs.ppd</i> |
732 | # <i>lpadmin -p HPDeskJet930C -E -v usb:/dev/ultp0 -m HP-DeskJet_930C-hpijs.ppd</i> |
| 736 | </pre> |
733 | </pre> |
| 737 | |
734 | |
| 738 | <p> |
735 | <p> |
| 739 | Remember to adjust to what you have. Be sure to have the name (-p) right (the |
736 | Remember to adjust to what you have. Be sure to have the name |
| 740 | name you set above during the Samba configuration!) and to put in the |
737 | (<c>-p</c> argument) right (the name you set above during the Samba |
| 741 | correct usb:/dev/usb/blah, parallel:/dev/blah or whatever device you |
738 | configuration!) and to put in the correct <c>usb:/dev/usb/blah</c>, |
| 742 | are using for your printer. |
739 | <c>parallel:/dev/blah</c> or whatever device you are using for your |
| 743 | </p> |
740 | printer. |
| 744 | |
|
|
| 745 | <p> |
741 | </p> |
|
|
742 | |
|
|
743 | <p> |
| 746 | You should now be able to access the printer from the web interface. You |
744 | You should now be able to access the printer from the web interface |
| 747 | should now be able to print a test page. |
745 | and be able to print a test page. |
| 748 | </p> |
746 | </p> |
| 749 | |
747 | |
| 750 | </body> |
748 | </body> |
| 751 | </section> |
749 | </section> |
| 752 | <section> |
750 | <section> |
| 753 | <title>Installing the Windows printer drivers</title> |
751 | <title>Installing the Windows printer drivers</title> |
| 754 | <body> |
752 | <body> |
| 755 | |
753 | |
| 756 | <p> |
754 | <p> |
| 757 | Now that the printer should be working it is time to install the drivers |
755 | Now that the printer should be working it is time to install the drivers |
| 758 | for the Windows clients to work. Samba 2.2 introduced this functionality. |
756 | for the Windows clients to work. Samba 2.2 introduced this functionality. |
| 759 | Browsing to the print server in the Network Neighbourhood, right-clicking |
757 | Browsing to the print server in the Network Neighbourhood, right-clicking |
| 760 | on the printershare and selecting "connect" downloads the appropriate |
758 | on the printershare and selecting "connect" downloads the appropriate |
| 761 | drivers automagically to the connecting client, avoiding the hassle of |
759 | drivers automagically to the connecting client, avoiding the hassle of |
| 762 | manually installing printer drivers locally. |
760 | manually installing printer drivers locally. |
| … | |
… | |
| 778 | |
776 | |
| 779 | <p> |
777 | <p> |
| 780 | This HOWTO uses the CUPS drivers for Windows. The downloaded file is |
778 | This HOWTO uses the CUPS drivers for Windows. The downloaded file is |
| 781 | called <path>cups-samba-5.0rc2.tar.gz</path>. Extract the files |
779 | called <path>cups-samba-5.0rc2.tar.gz</path>. Extract the files |
| 782 | contained into a directory. |
780 | contained into a directory. |
| 783 | </p> |
781 | </p> |
| 784 | |
782 | |
| 785 | <pre caption="Extract the drivers and run the install"> |
783 | <pre caption="Extract the drivers and run the install"> |
| 786 | # <i>tar -xzf cups-samba-5.0rc2.tar.gz</i> |
784 | # <i>tar -xzf cups-samba-5.0rc2.tar.gz</i> |
| 787 | # <i>cd cups-samba-5.0rc2</i> |
785 | # <i>cd cups-samba-5.0rc2</i> |
| 788 | <comment>(Only use this script if CUPS resides in /usr/share/cups)</comment> |
786 | <comment>(Only use this script if CUPS resides in /usr/share/cups)</comment> |
| 789 | # <i>./cups-samba.install</i> |
787 | # <i>./cups-samba.install</i> |
| 790 | </pre> |
788 | </pre> |
| 791 | |
789 | |
| 792 | <p> |
790 | <p> |
| 793 | cups-samba.ss is a TAR archive containing three files: |
791 | <path>cups-samba.ss</path> is a TAR archive containing three files: |
| 794 | cups5.hlp, cupsdrvr5.dll and cupsui5.dll. These are the actual driver |
792 | <path>cups5.hlp</path>, <path>cupsdrvr5.dll</path> and |
| 795 | files. |
793 | <path>cupsui5.dll</path>. These are the actual driver files. |
| 796 | </p> |
794 | </p> |
| 797 | |
795 | |
| 798 | <warn> |
796 | <warn> |
| 799 | The script cups-samba.install may not work for all *nixes (ie FreeBSD) |
797 | The script <c>cups-samba.install</c> may not work for all *nixes (ie FreeBSD) |
| 800 | because almost everything which is not part of the base system is |
798 | because almost everything which is not part of the base system is |
| 801 | installed somewhere under the prefix <path>/usr/local/</path>. This |
799 | installed somewhere under the prefix <path>/usr/local/</path>. This |
| 802 | seems not to be the case for most things you install under GNU/Linux. |
800 | seems not to be the case for most things you install under GNU/Linux. |
| 803 | However, if your CUPS installation is somewhere other than |
801 | However, if your CUPS installation is somewhere other than |
| 804 | <path>/usr/share/cups/</path> See the example below. |
802 | <path>/usr/share/cups/</path> see the example below. |
| 805 | </warn> |
803 | </warn> |
| 806 | |
804 | |
| 807 | <p> |
805 | <p> |
| 808 | Suppose your CUPS installation resides under |
806 | Suppose your CUPS installation resides under |
| 809 | <path>/usr/local/share/cups/</path>, and you want to install the drivers there. |
807 | <path>/usr/local/share/cups/</path>, and you want to install the drivers there. |
| 810 | Do the following: |
808 | Do the following: |
| 811 | </p> |
809 | </p> |
| 812 | |
810 | |
| 813 | <pre caption="Manually installing the drivers"> |
811 | <pre caption="Manually installing the drivers"> |
| 814 | # <i>cd /path/you/extracted/the/CUPS-driver/tarball/into</i> |
812 | # <i>cd /path/you/extracted/the/CUPS-driver/tarball/into</i> |
| 815 | # <i>tar -xf cups-samba.ss</i> |
813 | # <i>tar -xf cups-samba.ss</i> |
| 816 | <comment>(This extracts the files to usr/share/cups/drivers under the CURRENT WORKING DIRECTORY)</comment> |
814 | <comment>(This extracts the files to usr/share/cups/drivers under the CURRENT WORKING DIRECTORY)</comment> |
| 817 | # <i>cd usr/share/cups/drivers</i> |
815 | # <i>cd usr/share/cups/drivers</i> |
| 818 | <comment>(no leading / !)</comment> |
816 | <comment>(no leading / !)</comment> |
| 819 | # <i>cp cups* /usr/local/share/cups/drivers</i> |
817 | # <i>cp cups* /usr/local/share/cups/drivers</i> |
| … | |
… | |
| 832 | </pre> |
830 | </pre> |
| 833 | |
831 | |
| 834 | <warn> |
832 | <warn> |
| 835 | The execution of this command often causes the most trouble. |
833 | The execution of this command often causes the most trouble. |
| 836 | Reading through the <uri |
834 | Reading through the <uri |
| 837 | link="http://forums.gentoo.com/viewtopic.php?t=110931">posts in this |
835 | link="http://forums.gentoo.com/viewtopic.php?t=110931">posts in this |
| 838 | thread</uri>. |
836 | thread</uri>. |
| 839 | </warn> |
837 | </warn> |
| 840 | |
838 | |
| 841 | <p> |
839 | <p> |
| 842 | Here are common errors that may happen: |
840 | Here are common errors that may happen: |
| 843 | </p> |
841 | </p> |
| 844 | |
842 | |
| 845 | <ul> |
843 | <ul> |
| 846 | <li> |
844 | <li> |
| 847 | The hostname given as a parameter for -h and -H (PrintServer) often does |
845 | The hostname given as a parameter for <c>-h</c> and <c>-H</c> |
| 848 | not resolve correctly and doesn't identify the print server for CUPS/Samba |
846 | (<c>PrintServer</c>) often does not resolve correctly and doesn't |
| 849 | interaction. |
847 | identify the print server for CUPS/Samba interaction. If an error |
| 850 | If an error like: <b>Warning: No PPD file for printer "CUPS_PRINTER_NAME" - |
848 | like: <b>Warning: No PPD file for printer "CUPS_PRINTER_NAME" - |
| 851 | skipping!</b> occurs, the first thing you should do is substitute |
849 | skipping!</b> occurs, the first thing you should do is substitute |
| 852 | PrintServer with localhost and try it again. |
850 | <c>PrintServer</c> with <c>localhost</c> and try it again. |
| 853 | </li> |
851 | </li> |
| 854 | <li> |
852 | <li> |
| 855 | The command fails with an <b>NT_STATUS_UNSUCCESSFUL</b>. This error message |
853 | The command fails with an <b>NT_STATUS_UNSUCCESSFUL</b>. This error message |
| 856 | is quite common, but can be triggered by many problems. It's unfortunately |
854 | is quite common, but can be triggered by many problems. It's unfortunately |
| 857 | not very helpful. One thing to try is to temporarily set <b>security = |
855 | not very helpful. One thing to try is to temporarily set <c>security = |
| 858 | user</b> in your <path>smb.conf</path>. After/if the installation completes |
856 | user</c> in your <path>smb.conf</path>. After/if the installation completes |
| 859 | successfully, you should set it back to share, or whatever it was set to |
857 | successfully, you should set it back to share, or whatever it was set to |
| 860 | before. |
858 | before. |
| 861 | </li> |
859 | </li> |
| 862 | </ul> |
860 | </ul> |
| 863 | |
861 | |
| 864 | <p> |
862 | <p> |
| 865 | This should install the correct driver directory structure under |
863 | This should install the correct driver directory structure under |
| 866 | <path>/etc/samba/printer</path>. That would be |
864 | <path>/etc/samba/printer</path>. That would be |
| 867 | <path>/etc/samba/printer/W32X86/2/</path>. The files contained should |
865 | <path>/etc/samba/printer/W32X86/2/</path>. The files contained should |
| 868 | be the 3 driver files and the PPD file, renamed to YourPrinterName.ppd |
866 | be the 3 driver files and the PPD file, renamed to YourPrinterName.ppd |
| 869 | (the name which you gave the printer when installing it (see above). |
867 | (the name which you gave the printer when installing it (see above). |
| 870 | </p> |
868 | </p> |
| 871 | |
869 | |
| 872 | <p> |
870 | <p> |
| 873 | Pending no errors or other complications, your drivers are now |
871 | Pending no errors or other complications, your drivers are now |
| … | |
… | |
| 961 | <body> |
959 | <body> |
| 962 | |
960 | |
| 963 | <p> |
961 | <p> |
| 964 | Despite the variation or distribution, the only thing needed is CUPS. |
962 | Despite the variation or distribution, the only thing needed is CUPS. |
| 965 | Do the equivalent on any other UNIX/Linux/BSD client. |
963 | Do the equivalent on any other UNIX/Linux/BSD client. |
| 966 | </p> |
964 | </p> |
| 967 | |
965 | |
| 968 | <pre caption="Configuring a Gentoo system."> |
966 | <pre caption="Configuring a Gentoo system."> |
| 969 | # <i>emerge cups</i> |
967 | # <i>emerge cups</i> |
| 970 | # <i>/etc/init.d/cupsd start</i> |
968 | # <i>/etc/init.d/cupsd start</i> |
| 971 | # <i>rc-update add cupsd default</i> |
969 | # <i>rc-update add cupsd default</i> |
| 972 | </pre> |
970 | </pre> |
| 973 | |
971 | |
| 974 | <p> |
972 | <p> |
| 975 | That should be it. Nothing else will be needed. Just point your web |
973 | That should be it. Nothing else will be needed. Just point your web |
| 976 | browser to http://localhost:631 (on the CLIENT) and you'll see that |
974 | browser to <c>http://localhost:631</c> on the client and you'll see that |
| 977 | PrintServer broadcasts all available printers to all CUPS clients. |
975 | PrintServer broadcasts all available printers to all CUPS clients. |
| 978 | </p> |
976 | </p> |
| 979 | |
977 | |
| 980 | <p> |
978 | <p> |
| 981 | To print, use for example |
979 | To print, use for example |
| 982 | </p> |
980 | </p> |
| 983 | |
981 | |
| 984 | <pre caption="Printing in *nix"> |
982 | <pre caption="Printing in *nix"> |
| 985 | # <i>lpr -pHPDeskJet930C anything.txt</i> |
983 | # <i>lpr -pHPDeskJet930C anything.txt</i> |
| 986 | # <i>lpr -PHPDeskJet930C foobar.whatever.ps</i> |
984 | # <i>lpr -PHPDeskJet930C foobar.whatever.ps</i> |
| 987 | </pre> |
985 | </pre> |
| 988 | |
986 | |
| 989 | <p> |
987 | <p> |
| 990 | In order to setup a default printer, you have to edit |
988 | In order to setup a default printer, you have to edit |
| 991 | <path>/etc/cups/client.conf</path> and set the directive ServerName to |
989 | <path>/etc/cups/client.conf</path> and set the directive |
| 992 | your printserver. In the case of this guide that would be the |
990 | <c>ServerName</c> to your printserver. In the case of this guide that |
| 993 | following example. |
991 | would be the following example. |
| 994 | </p> |
992 | </p> |
| 995 | |
993 | |
| 996 | <pre caption="/etc/cups/client.conf"> |
994 | <pre caption="/etc/cups/client.conf"> |
| 997 | ServerName PrintServer |
995 | ServerName PrintServer |
| 998 | </pre> |
996 | </pre> |
| 999 | |
997 | |
| 1000 | <p> |
998 | <p> |
| 1001 | The following will print foorbar.whatever.ps directly to the print |
999 | The following will print <path>foorbar.whatever.ps</path> directly to the print |
| 1002 | server. |
1000 | server. |
| 1003 | </p> |
1001 | </p> |
| 1004 | |
1002 | |
| 1005 | <pre caption="Printing to the default printer"> |
1003 | <pre caption="Printing to the default printer"> |
| 1006 | $ <i>lpr foobar.whatever.ps</i> |
1004 | $ <i>lpr foobar.whatever.ps</i> |
| 1007 | </pre> |
1005 | </pre> |
| 1008 | |
1006 | |
| 1009 | <p> |
1007 | <p> |
| 1010 | Some common observations when setting a default printer in this manner |
1008 | Some common observations when setting a default printer in this manner |
| 1011 | include the following: |
1009 | include the following: |
| 1012 | </p> |
1010 | </p> |
| 1013 | |
1011 | |
| 1014 | <ul> |
1012 | <ul> |
| 1015 | <li> |
1013 | <li> |
| 1016 | Setting the ServerName in client.conf seems to work well for only one |
1014 | Setting the <c>ServerName</c> in <path>client.conf</path> seems to |
| 1017 | printer, there may be yet another way to set a client's default remote |
1015 | work well for only one printer, there may be yet another way to |
| 1018 | printer. |
1016 | set a client's default remote printer. |
| 1019 | </li> |
1017 | </li> |
| 1020 | <li> |
1018 | <li> |
| 1021 | Also, when accessing http://localhost:631 on the client now, no printers |
1019 | Also, when accessing <c>http://localhost:631</c> on the client |
| 1022 | seem to be "found" by the client-CUPS. This is to be expected when setting |
1020 | now, no printers seem to be "found" by the client-CUPS. This is to |
|
|
1021 | be expected when setting <c>ServerName</c> in |
| 1023 | ServerName in <path>client.conf</path>. |
1022 | <path>client.conf</path>. |
| 1024 | </li> |
1023 | </li> |
| 1025 | </ul> |
1024 | </ul> |
| 1026 | |
1025 | |
| 1027 | </body> |
1026 | </body> |
| 1028 | </section> |
1027 | </section> |
| 1029 | <section> |
1028 | <section> |
| 1030 | <title>Mounting a Windows or Samba share in GNU/Linux</title> |
1029 | <title>Mounting a Windows or Samba share in GNU/Linux</title> |
| 1031 | <body> |
1030 | <body> |
| 1032 | |
1031 | |
| 1033 | <p> |
1032 | <p> |
| 1034 | Now is time to configure our kernel to support it the smbfs. Since I'm |
1033 | Now is time to configure our kernel to support smbfs. Since I'm |
| 1035 | assumming we've all compiled at least one kernel, we'll need to make |
1034 | assumming we've all compiled at least one kernel, we'll need to make |
| 1036 | sure we have all the right options selected in our kernel. |
1035 | sure we have all the right options selected in our kernel. |
| 1037 | For simplicity sake, make it as a module for ease of use. It is the |
1036 | For simplicity sake, make it a module for ease of use. It is the |
| 1038 | authors opinion that kernel modules are a good thing and should be used |
1037 | authors opinion that kernel modules are a good thing and should be used |
| 1039 | whenever possible. |
1038 | whenever possible. |
| 1040 | </p> |
1039 | </p> |
| 1041 | |
1040 | |
| 1042 | <pre caption="Relevant kernel options" > |
1041 | <pre caption="Relevant kernel options" > |
| 1043 | CONFIG_SMB_FS=m |
1042 | CONFIG_SMB_FS=m |
| 1044 | CONFIG_SMB_UNIX=y |
1043 | CONFIG_SMB_UNIX=y |
| 1045 | </pre> |
1044 | </pre> |
| 1046 | |
1045 | |
| 1047 | <p> |
1046 | <p> |
| 1048 | Then make the module/install it; insert them with: |
1047 | Then make the module/install it; insert them with: |
| 1049 | </p> |
1048 | </p> |
| 1050 | |
1049 | |
| 1051 | <pre caption="Loading the kernel module"> |
1050 | <pre caption="Loading the kernel module"> |
| 1052 | # <i>modprobe smbfs</i> |
1051 | # <i>modprobe smbfs</i> |
| … | |
… | |
| 1068 | # <i>mount -t smbfs -o username=USERNAME,password=PASSWORD //PrintServer/public /mnt/public</i> |
1067 | # <i>mount -t smbfs -o username=USERNAME,password=PASSWORD //PrintServer/public /mnt/public</i> |
| 1069 | </pre> |
1068 | </pre> |
| 1070 | |
1069 | |
| 1071 | <p> |
1070 | <p> |
| 1072 | After you mount the share, you would access it as if it were a local |
1071 | After you mount the share, you would access it as if it were a local |
| 1073 | drive. |
1072 | drive. |
| 1074 | </p> |
1073 | </p> |
| 1075 | |
1074 | |
| 1076 | </body> |
1075 | </body> |
| 1077 | </section> |
1076 | </section> |
| 1078 | <section> |
1077 | <section> |
| 1079 | <title>Printer Configuration for Windows NT/2000/XP clients</title> |
1078 | <title>Printer Configuration for Windows NT/2000/XP clients</title> |
| 1080 | <body> |
1079 | <body> |
| 1081 | |
1080 | |
| 1082 | <p> |
1081 | <p> |
| 1083 | That's just a bit of point-and-click. Browse to \\PrintServer and right |
1082 | That's just a bit of point-and-click. Browse to |
| 1084 | click on the printer (HPDeskJet930C) and click connect. This will |
1083 | <path>\\PrintServer</path> and right click on the printer |
| 1085 | download the drivers to the Windows client and now every application |
1084 | (HPDeskJet930C) and click connect. This will download the drivers to |
| 1086 | (such as Word or Acrobat) will offer HPDeskJet930C as an available |
1085 | the Windows client and now every application (such as Word or Acrobat) |
| 1087 | printer to print to. :-) |
1086 | will offer HPDeskJet930C as an available printer to print to. :-) |
| 1088 | </p> |
1087 | </p> |
| 1089 | |
1088 | |
| 1090 | </body> |
1089 | </body> |
| 1091 | </section> |
1090 | </section> |
| 1092 | </chapter> |
1091 | </chapter> |
| 1093 | <chapter> |
1092 | <chapter> |
| 1094 | <title>Final Notes</title> |
1093 | <title>Final Notes</title> |
| 1095 | <section> |
1094 | <section> |
| 1096 | <title>A Fond Farewell</title> |
1095 | <title>A Fond Farewell</title> |
| 1097 | <body> |
1096 | <body> |
| 1098 | |
1097 | |
| 1099 | <p> |
1098 | <p> |
| 1100 | Well that should be it. You should now have a successful printing enviroment |
1099 | Well that should be it. You should now have a successful printing enviroment |
| 1101 | that is friendly to both Windows and *nix as well as a fully virus-free working |
1100 | that is friendly to both Windows and *nix as well as a fully virus-free working |
| 1102 | share! |
1101 | share! |