/[gentoo]/xml/htdocs/doc/en/quick-samba-howto.xml
Gentoo

Diff of /xml/htdocs/doc/en/quick-samba-howto.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.3
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>
13Setup, install and configure a Samba Server under Gentoo that shares 13Setup, install and configure a Samba Server under Gentoo that shares
14files, printers without the need to install drivers and provides 14files, printers without the need to install drivers and provides
15automatic virus scanning. 15automatic 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>
30 30
31<p> 31<p>
32This HOWTO is designed to help you move a network from many different 32This HOWTO is designed to help you move a network from many different
33clients speaking different languages, to many different manchines that 33clients speaking different languages, to many different manchines that
34speak a common language. The ultimate goal is to help differing 34speak a common language. The ultimate goal is to help differing
35architechures and technologies, come together in a productive, 35architectures and technologies, come together in a productive,
36happily coexistant environment. 36happily coexisting environment.
37</p> 37</p>
38 38
39<p> 39<p>
40Following the directions outlined in this HOWTO should give you an 40Following the directions outlined in this HOWTO should give you an
41excellent step towards a peaceful cohabitation between Windows, and 41excellent step towards a peaceful cohabitation between Windows, and
309<body> 309<body>
310 310
311<p> 311<p>
312First of all: be sure that all your hostnames resolve correctly. 312First of all: be sure that all your hostnames resolve correctly.
313Either have a working domain name system running on your network 313Either have a working domain name system running on your network
314or appropriate entries in your /etc/hosts file. cupsaddsmb often 314or appropriate entries in your <path>/etc/hosts</path> file.
315borks if hostnames don't point to the correct machines. 315<c>cupsaddsmb</c> often borks if hostnames don't point to the correct
316machines.
316</p> 317</p>
317 318
318<p> 319<p>
319Hopefully now you can make an assessment of what you'll actually need in 320Hopefully now you can make an assessment of what you'll actually need in
320order to use Samba with your particular setup. The setup used for this 321order to use Samba with your particular setup. The setup used for this
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>
357Because the oav USE flag only provides an interface to allow on access 358Because the <e>oav</e> USE flag only provides an interface to allow on access
358virus scanning, the actual virus scanner must be emerged. The scanner 359virus scanning, the actual virus scanner must be emerged. The scanner
359used in this HOWTO is <e>net-mail/clamav</e>. 360used 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>
399<p> 400<p>
400The main Samba configuration file is <path>/etc/samba/smb.conf</path>. 401The main Samba configuration file is <path>/etc/samba/smb.conf</path>.
401It is divided in sections indicated by [sectionname]. Comments are either 402It 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
403suggestions for modifications. If more details are required, see the 404suggestions for modifications. If more details are required, see the
404man page for <path>smb.conf</path>, the installed smb.conf.example, the Samba 405man page for <path>smb.conf</path>, the installed
405Web site or any of the numerous Samba books available. 406<path>smb.conf.example</path>, the Samba Web site or any of the
407numerous 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>
491create mode = 0766 493create mode = 0766
492guest ok = yes 494guest ok = yes
493path = /home/samba/public 495path = /home/samba/public
494</pre> 496</pre>
495 497
496<p> 498<warn>
497There 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 500If you like to use Samba's guest account to do anything concerning
503 printing from Windows clients: don't 501printing from Windows clients: don't set <c>guest only = yes</c> in
504 </li> 502the <c>[global]</c> section. The guest account seems to cause
505 <li>Don't set guest only = yes in the global section</li> 503problems 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 504connect 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 506printer 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> 508protect you from a lot of problems.
513</ul> 509</warn>
514 510
515<p> 511<p>
516Now create the directories required for the minimum configuration of 512Now create the directories required for the minimum configuration of
517Samba to share the installed printer throughout the network. 513Samba to share the installed printer throughout the network.
518</p> 514</p>
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>
551The configuration file specified to be used in <path>smb.conf</path> is 547The 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
613clamd socket name = /var/run/clamd 609clamd socket name = /var/run/clamd
614</pre> 610</pre>
615 611
616<p> 612<p>
617It is generally a good idea to start the virus scanner immediately. Add 613It is generally a good idea to start the virus scanner immediately. Add
618it to the default runlevel and then start the clamd service immediately. 614it 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>
628<section> 624<section>
629<title>Configuring CUPS</title> 625<title>Configuring CUPS</title>
630<body> 626<body>
631 627
632<p> 628<p>
633This is a little more complicated). CUPS' main config file is 629This 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
636in the example are the directives that need to be changed: 632in the example are the directives that need to be changed:
637</p> 633</p>
638 634
672&lt;/Location&gt; 668&lt;/Location&gt;
673</pre> 669</pre>
674 670
675<p> 671<p>
676Edit <path>/etc/cups/mime.convs</path> to uncomment some lines. 672Edit <path>/etc/cups/mime.convs</path> to uncomment some lines.
677The changes to mime.convs and mime.types are needed to make CUPSprint Microsoft Office document files. 673The changes to <path>mime.convs</path> and <path>mime.types</path> are
674needed 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>
682application/octet-stream application/vnd.cups-raw 0 679application/octet-stream application/vnd.cups-raw 0
724</p> 721</p>
725 722
726<p> 723<p>
727Now you have a PPD file for your printer to work with CUPS. Place it in 724Now 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
729named HP-DeskJet_930C-hpijs.ppd. You should now install the printer. 726named <path>HP-DeskJet_930C-hpijs.ppd</path>. You should now install the printer.
730This can be done via the CUPS web interface or via command line. The web 727This can be done via the CUPS web interface or via command line. The web
731interface is found at http://PrintServer:631 once CUPS is running. 728interface 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>
739Remember to adjust to what you have. Be sure to have the name (-p) right (the 736Remember to adjust to what you have. Be sure to have the name
740name 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
741correct usb:/dev/usb/blah, parallel:/dev/blah or whatever device you 738configuration!) and to put in the correct <c>usb:/dev/usb/blah</c>,
742are using for your printer. 739<c>parallel:/dev/blah</c> or whatever device you are using for your
743</p> 740printer.
744
745<p> 741</p>
742
743<p>
746You should now be able to access the printer from the web interface. You 744You should now be able to access the printer from the web interface
747should now be able to print a test page. 745and 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>
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>
793cups-samba.ss is a TAR archive containing three files: 791<path>cups-samba.ss</path> is a TAR archive containing three files:
794cups5.hlp, cupsdrvr5.dll and cupsui5.dll. These are the actual driver 792<path>cups5.hlp</path>, <path>cupsdrvr5.dll</path> and
795files. 793<path>cupsui5.dll</path>. These are the actual driver files.
796</p> 794</p>
797 795
798<warn> 796<warn>
799The script cups-samba.install may not work for all *nixes (ie FreeBSD) 797The script <c>cups-samba.install</c> may not work for all *nixes (ie FreeBSD)
800because almost everything which is not part of the base system is 798because almost everything which is not part of the base system is
801installed somewhere under the prefix <path>/usr/local/</path>. This 799installed somewhere under the prefix <path>/usr/local/</path>. This
802seems not to be the case for most things you install under GNU/Linux. 800seems not to be the case for most things you install under GNU/Linux.
803However, if your CUPS installation is somewhere other than 801However, 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>
808Suppose your CUPS installation resides under 806Suppose 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.
842Here are common errors that may happen: 840Here 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
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>
975That should be it. Nothing else will be needed. Just point your web 973That should be it. Nothing else will be needed. Just point your web
976browser to http://localhost:631 (on the CLIENT) and you'll see that 974browser to <c>http://localhost:631</c> on the client and you'll see that
977PrintServer broadcasts all available printers to all CUPS clients. 975PrintServer broadcasts all available printers to all CUPS clients.
978</p> 976</p>
979 977
980<p> 978<p>
981To print, use for example 979To print, use for example
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>
990In order to setup a default printer, you have to edit 988In 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
992your 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
993following example. 991would be the following example.
994</p> 992</p>
995 993
996<pre caption="/etc/cups/client.conf"> 994<pre caption="/etc/cups/client.conf">
997ServerName PrintServer 995ServerName PrintServer
998</pre> 996</pre>
999 997
1000<p> 998<p>
1001The following will print foorbar.whatever.ps directly to the print 999The following will print <path>foorbar.whatever.ps</path> directly to the print
1002server. 1000server.
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>
1011include the following: 1009include 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>
1034Now is time to configure our kernel to support it the smbfs. Since I'm 1033Now is time to configure our kernel to support smbfs. Since I'm
1035assumming we've all compiled at least one kernel, we'll need to make 1034assumming we've all compiled at least one kernel, we'll need to make
1036sure we have all the right options selected in our kernel. 1035sure we have all the right options selected in our kernel.
1037For simplicity sake, make it as a module for ease of use. It is the 1036For simplicity sake, make it a module for ease of use. It is the
1038authors opinion that kernel modules are a good thing and should be used 1037authors opinion that kernel modules are a good thing and should be used
1039whenever possible. 1038whenever possible.
1040</p> 1039</p>
1041 1040
1042<pre caption="Relevant kernel options" > 1041<pre caption="Relevant kernel options" >
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>
1083That's just a bit of point-and-click. Browse to \\PrintServer and right 1082That's just a bit of point-and-click. Browse to
1084click on the printer (HPDeskJet930C) and click connect. This will 1083<path>\\PrintServer</path> and right click on the printer
1085download 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 1085the Windows client and now every application (such as Word or Acrobat)
1087printer to print to. :-) 1086will 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>

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.20