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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.43 - (show annotations) (download) (as text)
Fri Jul 27 02:25:41 2012 UTC (2 years, 2 months ago) by nightmorph
Branch: MAIN
Changes since 1.42: +5 -5 lines
File MIME type: application/xml
mount-cifs is being removed from portage

1 <?xml version='1.0' encoding='UTF-8'?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/quick-samba-howto.xml,v 1.42 2011/03/02 09:19:55 nightmorph Exp $ -->
4
5 <guide>
6 <title>Gentoo Samba3/CUPS HOWTO</title>
7
8 <author title="Author">
9 Andreas "daff" Ntaflos <!--daff at dword dot org-->
10 </author>
11 <author title="Author">
12 <mail link="joshua@sungentoo.homeunix.com">Joshua Preston</mail>
13 </author>
14 <author title="Editor">
15 <mail link="nightmorph@gentoo.org">Joshua Saddler</mail>
16 </author>
17
18 <abstract>
19 Setup, install and configure a Samba server under Gentoo that shares files and
20 printers without the need to install drivers.
21 </abstract>
22
23 <!-- The content of this document is licensed under the CC-BY-SA license -->
24 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
25 <license/>
26
27 <version>3</version>
28 <date>2012-07-26</date>
29
30 <chapter>
31 <title>Introduction to this HOWTO</title>
32 <section>
33 <title>Purpose</title>
34 <body>
35
36 <p>
37 This HOWTO is designed to help you move a network from many different clients
38 speaking different languages, to many different machines that speak a common
39 language. The ultimate goal is to help differing architectures and technologies,
40 come together in a productive, happily coexisting environment.
41 </p>
42
43 <p>
44 Following the directions outlined in this HOWTO should give you an excellent
45 step towards a peaceful cohabitation between Windows, and virtually all known
46 variations of *nix.
47 </p>
48
49 <p>
50 This HOWTO originally started not as a HOWTO, but as a FAQ. It was intended to
51 explore the functionality and power of the Gentoo system, portage and the
52 flexibility of USE flags. Like so many other projects, it was quickly discovered
53 what was missing in the Gentoo realm: there weren't any Samba HOWTOs catered
54 for Gentoo users. These users are more demanding than most; they require
55 performance, flexibility and customization. This does not however imply that
56 this HOWTO was not intended for other distributions; rather that it was designed
57 to work with a highly customized version of Samba.
58 </p>
59
60 <p>
61 This HOWTO will describe how to share files and printers between Windows PCs and
62 *nix PCs. It will also show you how to mount and manipulate shares.
63 </p>
64
65 <p>
66 There are a few topics that will be mentioned, but are out of the scope of this
67 HOWTO. These will be noted as they are presented.
68 </p>
69
70 <p>
71 This HOWTO is based on a compilation and merge of an excellent HOWTO provided
72 in the <uri link="http://forums.gentoo.org">Gentoo forums</uri> by Andreas
73 "daff" Ntaflos and the collected knowledge of Joshua Preston. The link to this
74 discussion is provided below for your reference:
75 </p>
76
77 <ul>
78 <li>
79 <uri link="http://forums.gentoo.org/viewtopic.php?t=110931">HOWTO
80 CUPS+Samba: printing from Windows &amp; Linux</uri>
81 </li>
82 </ul>
83
84 </body>
85 </section>
86 <section>
87 <title>Before you use this guide</title>
88 <body>
89
90 <p>
91 There are a several other guides for setting up CUPS and/or Samba, please read
92 them as well, as they may tell you things left out of this HOWTO (intentional or
93 otherwise). One such document is the very useful and well written <uri
94 link="/doc/en/printing-howto.xml">Gentoo Printing Guide</uri>, as configuration
95 issues and specific printer setup is not discussed here.
96 </p>
97
98 </body>
99 </section>
100 <section>
101 <title>Brief Overview</title>
102 <body>
103
104 <p>
105 After presenting the various USE flags, the following list will outline all of
106 the topics covered as they are presented:
107 </p>
108
109 <ul>
110 <li>On the Samba server:
111 <ul>
112 <li>Install and configure Samba</li>
113 <li>Install and configure CUPS</li>
114 <li>Adding the printer to CUPS</li>
115 <li>Adding the PS drivers for the Windows clients</li>
116 </ul>
117 </li>
118 <li>On the Unix clients:
119 <ul>
120 <li>Install and configure CUPS</li>
121 <li>Configuring a default printer</li>
122 <li>Mounting a Windows or Samba share</li>
123 </ul>
124 </li>
125 <li>On the Windows Clients:
126 <ul>
127 <li>Configuring the printer</li>
128 <li>Accessing Samba shares</li>
129 </ul>
130 </li>
131 </ul>
132
133 </body>
134 </section>
135 <section>
136 <title>Requirements</title>
137 <body>
138
139 <p>
140 We will need the following:
141 </p>
142
143 <ul>
144 <li>net-fs/samba</li>
145 <li>net-print/cups (built with the <c>ppds</c> USE flag)</li>
146 <li>net-print/hplip (if you have an HP printer)</li>
147 <li>A kernel of sorts (2.6)</li>
148 <li>A printer (PS or non-PS)</li>
149 <li>
150 A working network (home/office/etc) consisting of more than one machine)
151 </li>
152 </ul>
153
154 <p>
155 The main package we use here is <c>net-fs/samba</c>, however, you will need a
156 kernel with CIFS support enabled in order to mount a Samba or Windows share from
157 another computer. CUPS will be emerged if it is not already.
158 </p>
159
160 </body>
161 </section>
162 </chapter>
163
164 <chapter>
165 <title>Getting acquainted with Samba</title>
166 <section>
167 <title>The USE Flags</title>
168 <body>
169
170 <p>
171 Before emerging anything, take a look at some of the various USE flags available
172 to Samba.
173 </p>
174
175 <pre caption="Samba uses the following USE Variables:">
176 kerberos acl cups ldap pam readline python winbind
177 </pre>
178
179 <p>
180 Depending on the network topology and the specific requirements of the server,
181 the USE flags outlined below will define what to include or exclude from the
182 emerging of Samba.
183 </p>
184
185 <table>
186 <tr>
187 <th><b>USE flag</b></th>
188 <th>Description</th>
189 </tr>
190 <tr>
191 <th><b>kerberos</b></th>
192 <ti>
193 Include support for Kerberos. The server will need this if it is intended
194 to join an existing domain or Active Directory. See the note below for more
195 information.
196 </ti>
197 </tr>
198 <tr>
199 <th><b>acl</b></th>
200 <ti>
201 Enables Access Control Lists. The ACL support in Samba uses a patched
202 ext2/ext3, or SGI's XFS in order to function properly as it extends more
203 detailed access to files or directories; much more so than typical *nix
204 GID/UID schemas.
205 </ti>
206 </tr>
207 <tr>
208 <th><b>cups</b></th>
209 <ti>
210 This enables support for the Common Unix Printing System. This provides an
211 interface allowing local CUPS printers to be shared to other systems in the
212 network.
213 </ti>
214 </tr>
215 <tr>
216 <th><b>ldap</b></th>
217 <ti>
218 Enables the Lightweight Directory Access Protocol (LDAP). If Samba is
219 expected to use Active Directory, this option must be used. This would be
220 used in the event Samba needs to login to or provide login to a
221 Domain/Active Directory Server. The kerberos USE flag is needed for proper
222 functioning of this option.
223 </ti>
224 </tr>
225 <tr>
226 <th><b>pam</b></th>
227 <ti>
228 Include support for pluggable authentication modules (PAM). This provides
229 the ability to authenticate users on the Samba Server, which is required if
230 users have to login to your server. The kerberos USE flag is recommended
231 along with this option.
232 </ti>
233 </tr>
234 <tr>
235 <th><b>readline</b></th>
236 <ti>
237 Link Samba against libreadline. This is highly recommended and should
238 probably not be disabled.
239 </ti>
240 </tr>
241 <tr>
242 <th><b>python</b></th>
243 <ti>
244 Python bindings API. Provides an API that will allow Python to interface
245 with Samba.
246 </ti>
247 </tr>
248 <tr>
249 <th><b>winbind</b></th>
250 <ti>
251 Winbind allows for a unified logon within a Samba environment. It uses a
252 Unix implementation of Windows RPC calls, PAM and the name service switch
253 (supported by the c library) to enable Windows NT domain users to appear and
254 work as Unix users on a Unix system.
255 </ti>
256 </tr>
257 </table>
258
259 <p>
260 A couple of things worth mentioning about the USE flags and different
261 Samba functions include:
262 </p>
263
264 <ul>
265 <li>
266 ACLs on ext2/3 are implemented through extended attributes (EAs). EA and
267 ACL kernel options for ext2 and/or ext3 will need to be enabled (depending
268 on which file system is being used - both can be enabled).
269 </li>
270 <li>
271 While Active Directory, ACL, and PDC functions are out of the intended
272 scope of this HOWTO, you may find these links as helpful to your cause:
273 <ul>
274 <li><uri>http://www.bluelightning.org/linux/samba_acl_howto/</uri></li>
275 <li><uri>http://www.wlug.org.nz/HowtoSamba3AndActiveDirectory</uri></li>
276 </ul>
277 </li>
278 </ul>
279
280 </body>
281 </section>
282 </chapter>
283
284 <chapter>
285 <title>Server Software Installation</title>
286 <section>
287 <title>Emerging Samba</title>
288 <body>
289
290 <p>
291 First of all: be sure that all your hostnames resolve correctly. Either have a
292 working domain name system running on your network or appropriate entries in
293 your <path>/etc/hosts</path> file. <c>cupsaddsmb</c> often borks if hostnames
294 don't point to the correct machines.
295 </p>
296
297 <p>
298 Hopefully now you can make an assessment of what you'll actually need in order
299 to use Samba with your particular setup. The setup used for this HOWTO is:
300 </p>
301
302 <ul>
303 <li>cups</li>
304 <li>readline</li>
305 <li>pam</li>
306 </ul>
307
308 <p>
309 To optimize performance, size and the time of the build, the USE flags are
310 specifically included or excluded.
311 </p>
312
313 <p>
314 First, add <c>ppds</c> to your USE flags to make sure that when CUPS is built,
315 it has proper foomatic support:
316 </p>
317
318 <pre caption="Adding ppds">
319 # <i>echo "net-print/cups ppds" &gt;&gt; /etc/portage/package.use</i>
320 </pre>
321
322 <p>
323 Now, emerge Samba:
324 </p>
325
326 <pre caption="Emerge Samba">
327 # <i>echo "net-fs/samba readline cups pam" &gt;&gt; /etc/portage/package.use</i>
328 # <i>emerge net-fs/samba</i>
329 </pre>
330
331 <p>
332 This will emerge Samba and CUPS.
333 </p>
334
335 </body>
336 </section>
337 <section>
338 <title>Emerging net-print/hplip</title>
339 <body>
340
341 <p>
342 You only need to emerge this if you use an HP printer.
343 </p>
344
345 <pre caption="Emerge hplip">
346 # <i>emerge net-print/hplip</i>
347 </pre>
348
349 </body>
350 </section>
351 </chapter>
352
353 <chapter>
354 <title>Server Configuration</title>
355 <section>
356 <title>Configuring Samba</title>
357 <body>
358
359 <p>
360 The main Samba configuration file is <path>/etc/samba/smb.conf</path>. It is
361 divided in sections indicated by [sectionname]. Comments are either
362 # or ;. A sample <path>smb.conf</path> is included below with comments and
363 suggestions for modifications. If more details are required, see the man page
364 for <path>smb.conf</path>, the installed <path>smb.conf.example</path>, the
365 Samba Web site or any of the numerous Samba books available.
366 </p>
367
368 <pre caption="A Sample /etc/samba/smb.conf">
369 [global]
370 <comment># Replace MYWORKGROUPNAME with your workgroup/domain</comment>
371 workgroup = <comment>MYWORKGROUPNAME</comment>
372 <comment># Of course this has no REAL purpose other than letting
373 # everyone knows it's not Windows!
374 # %v prints the version of Samba we are using.</comment>
375 server string = Samba Server %v
376 <comment># We are going to use cups, so we are going to put it in here ;-)</comment>
377 printcap name = cups
378 printing = cups
379 load printers = yes
380 <comment># We want a log file and we do not want it to get bigger than 50kb.</comment>
381 log file = /var/log/samba/log.%m
382 max log size = 50
383 <comment># We are going to set some options for our interfaces...</comment>
384 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
385 <comment># This is a good idea, what we are doing is binding the
386 # samba server to our local network.
387 # For example, if eth0 is our local network device</comment>
388 interfaces = lo <i>eth0</i>
389 bind interfaces only = yes
390 <comment># Now we are going to specify who we allow, we are afterall
391 # very security conscience, since this configuration does
392 # not use passwords!</comment>
393 hosts allow = 127.0.0.1 <i>192.168.1.0/24</i>
394 hosts deny = 0.0.0.0/0
395 <comment># Other options for this are USER, DOMAIN, ADS, and SERVER
396 # The default is user</comment>
397 security = share
398 <comment># No passwords, so we're going to use a guest account!</comment>
399 guest ok = yes
400
401 <comment># Now we setup our print drivers information!</comment>
402 [print$]
403 comment = Printer Drivers
404 path = /etc/samba/printer <comment># this path holds the driver structure</comment>
405 guest ok = yes
406 browseable = yes
407 read only = yes
408 <comment># Modify this to "username,root" if you don't want root to
409 # be the only printer admin)</comment>
410 write list = <i>root</i>
411
412 <comment># Now we'll setup a printer to share, while the name is arbitrary
413 # it should be consistent throughout Samba and CUPS!</comment>
414 [HPDeskJet930C]
415 comment = HP DeskJet 930C Network Printer
416 printable = yes
417 path = /var/spool/samba
418 public = yes
419 guest ok = yes
420 <comment># Modify this to "username,root" if you don't want root to
421 # be the only printer admin)</comment>
422 printer admin = <i>root</i>
423
424 <comment># Now we setup our printers share. This should be
425 # browseable, printable, public.</comment>
426 [printers]
427 comment = All Printers
428 browseable = no
429 printable = yes
430 writable = no
431 public = yes
432 guest ok = yes
433 path = /var/spool/samba
434 <comment># Modify this to "username,root" if you don't want root to
435 # be the only printer admin)</comment>
436 printer admin = <i>root</i>
437
438 <comment># We create a new share that we can read/write to from anywhere
439 # This is kind of like a public temp share, anyone can do what
440 # they want here.</comment>
441 [public]
442 comment = Public Files
443 browseable = yes
444 public = yes
445 create mode = 0766
446 guest ok = yes
447 path = /home/samba/public
448 </pre>
449
450 <warn>
451 If you like to use Samba's guest account to do anything concerning printing from
452 Windows clients: don't set <c>guest only = yes</c> in the <c>[global]</c>
453 section. The guest account seems to cause problems when running
454 <c>cupsaddsmb</c> sometimes when trying to connect from Windows machines. See
455 below, too, when we talk about <c>cupsaddsmb</c> and the problems that can
456 arise. Use a dedicated printer user, like <c>printeruser</c> or <c>printer</c>
457 or <c>printme</c> or whatever. It doesn't hurt and it will certainly protect you
458 from a lot of problems.
459 </warn>
460
461 <p>
462 Now create the directories required for the minimum configuration of Samba to
463 share the installed printer throughout the network.
464 </p>
465
466 <pre caption="Create the directories">
467 # <i>mkdir /etc/samba/printer</i>
468 # <i>mkdir /var/spool/samba</i>
469 # <i>mkdir /home/samba/public</i>
470 </pre>
471
472 <p>
473 At least one Samba user is required in order to install the printer drivers and
474 to allow users to connect to the printer. Users must exist in the system's
475 <path>/etc/passwd</path> file.
476 </p>
477
478 <pre caption="Creating the users">
479 # <i>smbpasswd -a root</i>
480
481 <comment>(If another user is to be a printer admin)</comment>
482 # <i>smbpasswd -a username</i>
483 </pre>
484
485 <p>
486 The Samba passwords need not be the same as the system passwords
487 in <path>/etc/passwd</path>.
488 </p>
489
490 <p>
491 You will also need to update <path>/etc/nsswitch.conf</path> so that Windows
492 systems can be found easily using NetBIOS:
493 </p>
494
495 <pre caption="Editing /etc/nsswitch.conf">
496 # <i>nano -w /etc/nsswitch.conf</i>
497 <comment>(Edit the hosts: line)</comment>
498 hosts: files dns <i>wins</i>
499 </pre>
500
501 </body>
502 </section>
503 <section>
504 <title>Configuring CUPS</title>
505 <body>
506
507 <p>
508 This is a little more complicated. CUPS' main config file is
509 <path>/etc/cups/cupsd.conf</path>. It's structure is similar to Apache's
510 <path>httpd.conf</path> file, so many you may find it familiar. Outlined in the
511 example are the directives that need to be changed:
512 </p>
513
514 <pre caption="/etc/cups/cupsd.conf">
515 ServerName <i>PrintServer</i> <comment># your printserver name</comment>
516 ServerAdmin <i>root@PrintServer</i> <comment># the person for printer-related hate-mail, e.g. you</comment>
517
518 AccessLog /var/log/cups/access_log <comment># probably doesn't need changing</comment>
519 ErrorLog /var/log/cups/error_log <comment># doesn't really need changing either</comment>
520
521 LogLevel debug <comment># only while installing and testing, should later be
522 # changed to 'info'</comment>
523
524 MaxClients 100 <comment># I've had to set this to 1000000000 or so because some time back,
525 # there seemed to be a bug in CUPS' controlling of the web interface,
526 # making CUPS think a denial of service attack was in progress when
527 # I tried to configure a printer with the web interface. weird.</comment>
528
529 BrowseAddress @IF(<i>eth0</i>) <comment># Change this to your internal net interface</comment>
530
531 &lt;Location /&gt;
532 Order Deny,Allow
533 Deny From All
534 Allow From <i>192.168.1.*</i> <comment># the addresses of your internel network
535 # e.g. 192.168.1.* will allow connections from any host on
536 # the 192.168.1.0 network. change to whatever suits you</comment>
537 &lt;/Location&gt;
538
539 &lt;Location /admin&gt;
540 AuthType Basic
541 AuthClass System
542 Allow From <i>192.168.1.*</i> <comment># same as above, allow any host on the
543 # 192.168.1.0 network to connect and do
544 # administrative tasks after authenticating</comment>
545 Order Deny,Allow
546 Deny From All
547 &lt;/Location&gt;
548 </pre>
549
550 <p>
551 Edit <path>/etc/cups/mime.convs</path> to uncomment some lines. The changes to
552 <path>mime.convs</path> and <path>mime.types</path> are needed to make CUPS
553 print Microsoft Office document files.
554 </p>
555
556 <pre caption="/etc/cups/mime.convs">
557 <comment>(The following line is found near the end of the file. Uncomment it)</comment>
558 application/octet-stream application/vnd.cups-raw 0
559 </pre>
560
561 <p>
562 Edit <path>/etc/cups/mime.types</path> to uncomment some lines.
563 </p>
564
565 <pre caption="/etc/cups/mime.types">
566 <comment>(The following line is found near the end of the file. Uncomment it)</comment>
567 application/octet-stream
568 </pre>
569
570 <p>
571 CUPS needs to be started on boot, and started immediately.
572 </p>
573
574 <pre caption="Setting up the CUPS service" >
575 <comment>(To start CUPS on boot)</comment>
576 # <i>rc-update add cupsd default</i>
577 <comment>(To start or restart CUPS now)</comment>
578 # <i>/etc/init.d/cupsd restart</i>
579 </pre>
580
581 </body>
582 </section>
583 <section>
584 <title>Installing a printer for and with CUPS</title>
585 <body>
586
587 <p>
588 First, go to <uri link="http://linuxprinting.org">LinuxPrinting.Org</uri> to
589 find and download the correct PPD file for your printer and CUPS. To do so,
590 click the link Printer Listings to the left. Select your printers manufacturer
591 and the model in the pulldown menu, e.g. HP and DeskJet 930C. Click "Show". On
592 the page coming up click the "recommended driver" link after reading the various
593 notes and information. Then fetch the PPD file from the next page, again after
594 reading the notes and introductions there. You may have to select your printers
595 manufacturer and model again. Reading the <uri
596 link="http://www.linuxprinting.org/cups-doc.html">CUPS quickstart guide</uri> is
597 also very helpful when working with CUPS.
598 </p>
599
600 <p>
601 Now you have a PPD file for your printer to work with CUPS. Place it in
602 <path>/usr/share/cups/model</path>. The PPD for the HP DeskJet 930C was named
603 <path>HP-DeskJet_930C-hpijs.ppd</path>. You should now install the printer.
604 This can be done via the CUPS web interface or via command line. The web
605 interface is found at <path>http://PrintServer:631</path> once CUPS is running.
606 </p>
607
608 <pre caption="Install the printer via command line">
609 # <i>lpadmin -p HPDeskJet930C -E -v usb:/dev/ultp0 -m HP-DeskJet_930C-hpijs.ppd</i>
610 # <i>/etc/init.d/cupsd restart</i>
611 </pre>
612
613 <p>
614 Remember to adjust to what you have. Be sure to have the name (<c>-p</c>
615 argument) right (the name you set above during the Samba configuration!) and to
616 put in the correct <c>usb:/dev/usb/blah</c>, <c>parallel:/dev/blah</c> or
617 whatever device you are using for your printer.
618 </p>
619
620 <p>
621 You should now be able to access the printer from the web interface and be able
622 to print a test page.
623 </p>
624
625 </body>
626 </section>
627 <section>
628 <title>Installing the Windows printer drivers</title>
629 <body>
630
631 <p>
632 Now that the printer should be working it is time to install the drivers for
633 the Windows clients to work. Samba 2.2 introduced this functionality. Browsing
634 to the print server in the Network Neighbourhood, right-clicking on the
635 printershare and selecting "connect" downloads the appropriate drivers
636 automagically to the connecting client, avoiding the hassle of manually
637 installing printer drivers locally.
638 </p>
639
640 <p>
641 There are two sets of printer drivers for this. First, the Adobe PS drivers
642 which can be obtained from <uri
643 link="http://www.adobe.com/support/downloads/main.html">Adobe</uri> (PostScript
644 printer drivers). Second, there are the CUPS PS drivers, to be obtained by
645 emerging <c>net-print/cups-windows</c>. There doesn't seem to be a difference
646 between the functionality of the two, but the Adobe PS drivers need to be
647 extracted on a Windows System since it's a Windows binary. Also the whole
648 procedure of finding and copying the correct files is a bit more hassle. The
649 CUPS drivers support some options the Adobe drivers don't.
650 </p>
651
652 <p>
653 This HOWTO uses the CUPS drivers for Windows. Install them as shown:
654 </p>
655
656 <pre caption="Install the drivers">
657 # <i>emerge -av cups-windows</i>
658 </pre>
659
660 <p>
661 Now we'll use the script <c>cupsaddsmb</c> provided by the CUPS distribution.
662 Be sure to read its manpage (<c>man cupsaddsmb</c>), as it will tell you which
663 Windows drivers you'll need to copy to the proper CUPS directory. Once you've
664 copied the drivers, restart CUPS by running <c>/etc/init.d/cupsd restart</c>.
665 Next, run <c>cupsaddsmb</c> as shown:
666 </p>
667
668 <pre caption="Run cupsaddsmb">
669 # <i>cupsaddsmb -H PrintServer -U root -h PrintServer -v HPDeskJet930C</i>
670 <comment>(Instead of HPDeskJet930C you could also specify "-a", which will
671 "export all known printers".)</comment>
672 # <i>cupsaddsmb -H PrintServer -U root -h PrintServer -a</i>
673 </pre>
674
675 <warn>
676 The execution of this command often causes the most trouble. Read through the
677 <uri link="http://forums.gentoo.org/viewtopic.php?t=110931">posts in this
678 thread</uri> for some troubleshooting tips.
679 </warn>
680
681 <p>
682 Here are common errors that may happen:
683 </p>
684
685 <ul>
686 <li>
687 The hostname given as a parameter for <c>-h</c> and <c>-H</c>
688 (<c>PrintServer</c>) often does not resolve correctly and doesn't identify
689 the print server for CUPS/Samba interaction. If an error like: <b>Warning:
690 No PPD file for printer "CUPS_PRINTER_NAME" - skipping!</b> occurs, the
691 first thing you should do is substitute <c>PrintServer</c> with
692 <c>localhost</c> and try it again.
693 </li>
694 <li>
695 The command fails with an <b>NT_STATUS_UNSUCCESSFUL</b>. This error message
696 is quite common, but can be triggered by many problems. It's unfortunately
697 not very helpful. One thing to try is to temporarily set <c>security =
698 user</c> in your <path>smb.conf</path>. After/if the installation completes
699 successfully, you should set it back to share, or whatever it was set to
700 before.
701 </li>
702 </ul>
703
704 <p>
705 This should install the correct driver directory structure under
706 <path>/etc/samba/printer</path>. That would be
707 <path>/etc/samba/printer/W32X86/2/</path>. The files contained should be the 3
708 driver files and the PPD file, renamed to <path>YourPrinterName.ppd</path> (the
709 name which you gave the printer when installing it (see above).
710 </p>
711
712 <p>
713 Pending no errors or other complications, your drivers are now installed.
714 </p>
715
716 </body>
717 </section>
718 <section>
719 <title>Finalizing our setup</title>
720 <body>
721
722 <p>
723 Lastly, setup our directories.
724 </p>
725
726 <pre caption="Final changes needed">
727 # <i>mkdir /home/samba</i>
728 # <i>mkdir /home/samba/public</i>
729 # <i>chmod 755 /home/samba</i>
730 # <i>chmod 755 /home/samba/public</i>
731 </pre>
732
733 </body>
734 </section>
735 <section>
736 <title>Testing our Samba configuration</title>
737 <body>
738
739 <p>
740 We will want to test our configuration file to ensure that it is formatted
741 properly and all of our options have at least the correct syntax. To do this we
742 run <c>testparm</c>.
743 </p>
744
745 <pre caption="Running the testparm">
746 <comment>(By default, testparm checks /etc/samba/smb.conf)</comment>
747 # <i>/usr/bin/testparm</i>
748 Load smb config files from /etc/samba/smb.conf
749 Processing section &quot;[printers]&quot;
750 Global parameter guest account found in service section!
751 Processing section &quot;[public]&quot;
752 Global parameter guest account found in service section!
753 Loaded services file OK.
754 Server role: ROLE_STANDALONE
755 Press enter to see a dump of your service definitions
756 ...
757 ...
758 </pre>
759
760 </body>
761 </section>
762 <section>
763 <title>Starting the Samba service</title>
764 <body>
765
766 <p>
767 Now configure Samba to start at bootup; then go ahead and start it.
768 </p>
769
770 <pre caption="Setting up the Samba service">
771 # <i>rc-update add samba default</i>
772 # <i>/etc/init.d/samba start</i>
773 </pre>
774
775 </body>
776 </section>
777 <section>
778 <title>Checking our services</title>
779 <body>
780
781 <p>
782 It would probably be prudent to check our logs at this time also. We will also
783 want to take a peak at our Samba shares using <c>smbclient</c>.
784 </p>
785
786 <pre caption="Checking the shares with smbclient">
787 # <i>smbclient -L localhost</i>
788 Password:
789 <comment>(You should see a BIG list of services here.)</comment>
790 </pre>
791
792 </body>
793 </section>
794 </chapter>
795
796 <chapter>
797 <title>Configuration of the Clients</title>
798 <section>
799 <title>Printer configuration of *nix based clients</title>
800 <body>
801
802 <p>
803 Despite the variation or distribution, the only thing needed is CUPS. Do the
804 equivalent on any other UNIX/Linux/BSD client.
805 </p>
806
807 <pre caption="Configuring a Gentoo system">
808 # <i>emerge cups</i>
809 # <i>nano -w /etc/cups/client.conf</i>
810 ServerName <i>PrintServer</i> <comment># your printserver name</comment>
811 </pre>
812
813 <p>
814 That should be it. Nothing else will be needed.
815 </p>
816
817 <p>
818 If you use only one printer, it will be your default printer. If your print
819 server manages several printers, your administrator will have defined a default
820 printer on the server. If you want to define a different default printer for
821 yourself, use the <c>lpoptions</c> command.
822 </p>
823
824 <pre caption="Setting your default printer">
825 <comment>(List available printers)</comment>
826 # <i>lpstat -a</i>
827 <comment>(Sample output, yours will differ)</comment>
828 HPDeskJet930C accepting requests since Jan 01 00:00
829 laser accepting requests since Jan 01 00:00
830 <comment>(Define HPDeskJet930C as your default printer)</comment>
831 # <i>lpoptions -d HPDeskJet930C</i>
832 </pre>
833
834 <pre caption="Printing in *nix">
835 <comment>(Specify the printer to be used)</comment>
836 # <i>lp -d HPDeskJet930C anything.txt</i>
837 <comment>(Use your default printer)</comment>
838 # <i>lp foobar.whatever.ps</i>
839 </pre>
840
841 <p>
842 Just point your web browser to <c>http://printserver:631</c> on the client if
843 you want to manage your printers and their jobs with a nice web interface.
844 Replace <c>printserver</c> with the name of the <e>machine</e> that acts as your
845 print server, not the name you gave to the cups print server if you used
846 different names.
847 </p>
848
849 </body>
850 </section>
851 <section>
852 <title>Mounting a Windows or Samba share in GNU/Linux</title>
853 <body>
854
855 <note>
856 Don't forget to install <c>net-fs/samba</c> on the client(s) that will be
857 accessing the shares.
858 </note>
859
860 <p>
861 Now is time to configure our kernel to support CIFS. Since I'm assuming
862 we've all compiled at least one kernel, we'll need to make sure we have all the
863 right options selected in our kernel. For simplicity's sake, make it a module
864 for ease of use. It is the author's opinion that kernel modules are a good thing
865 and should be used whenever possible.
866 </p>
867
868 <pre caption="Kernel support" >
869 CONFIG_CIFS=m
870 </pre>
871
872 <p>
873 Then make the module/install it; insert it with:
874 </p>
875
876 <pre caption="Loading the kernel module">
877 # <i>modprobe cifs</i>
878 </pre>
879
880 <p>
881 Once the module is loaded, mounting a Windows or Samba share is possible. Use
882 <c>mount</c> to accomplish this, as detailed below:
883 </p>
884
885 <pre caption="Mounting a Windows/Samba share">
886 <comment>(The syntax for mounting a Windows/Samba share is:
887 mount -t cifs [-o username=xxx,password=xxx] //server/share /mnt/point
888 If we are not using passwords or a password is not needed)</comment>
889
890 # <i>mount -t cifs //PrintServer/public /mnt/public</i>
891
892 <comment>(If a password is needed)</comment>
893 # <i>mount -t cifs -o username=USERNAME,password=PASSWORD //PrintServer/public /mnt/public</i>
894 </pre>
895
896 <p>
897 After you mount the share, you would access it as if it were a local drive.
898 </p>
899
900 </body>
901 </section>
902 <section>
903 <title>Printer Configuration for Windows NT/2000/XP clients</title>
904 <body>
905
906 <p>
907 That's just a bit of point-and-click. Browse to <path>\\PrintServer</path> and
908 right click on the printer (HPDeskJet930C) and click connect. This will download
909 the drivers to the Windows client and now every application (such as Word or
910 Acrobat) will offer HPDeskJet930C as an available printer to print to. :-)
911 </p>
912
913 </body>
914 </section>
915 </chapter>
916
917 <chapter>
918 <title>Final Notes</title>
919 <section>
920 <title>A Fond Farewell</title>
921 <body>
922
923 <p>
924 That should be it. You should now have a successful printing enviroment that is
925 friendly to both Windows and *nix as well as a working share!
926 </p>
927
928 </body>
929 </section>
930 </chapter>
931
932 <chapter>
933 <title>Links and Resources</title>
934 <section>
935 <title>Links</title>
936 <body>
937
938 <p>
939 These are some links that may help you in setting up, configuration and
940 troubleshooting your installation:
941 </p>
942
943 <ul>
944 <li><uri link="http://www.cups.org/">CUPS Homepage</uri></li>
945 <li>
946 <uri link="http://www.samba.org/">Samba Homepage</uri>, especially the <uri
947 link="http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/CUPS-printing.html">chapter
948 on Samba/CUPS configuration</uri>
949 </li>
950 <li><uri link="http://linuxprinting.org/">LinuxPrinting dot Org</uri></li>
951 <li>
952 <uri link="http://www.linuxprinting.org/kpfeifle/SambaPrintHOWTO/">Kurt
953 Pfeifle's Samba Print HOWTO</uri> ( This HOWTO really covers <e>ANYTHING</e>
954 and <e>EVERYTHING</e> I've written here, plus a LOT more concerning CUPS and
955 Samba, and generally printing support on networks. A really interesting
956 read, with lots and lots of details.)
957 </li>
958 <li><uri link="http://www.freebsddiary.org/cups.php">FreeBSD Diary's CUPS Topic</uri></li>
959 </ul>
960
961 </body>
962 </section>
963 <section>
964 <title>Troubleshooting</title>
965 <body>
966
967 <p>
968 See <uri
969 link="http://www.linuxprinting.org/kpfeifle/SambaPrintHOWTO/Samba-HOWTO-Collection-3.0-PrintingChapter-11th-draft.html#37">this
970 page</uri> from Kurt Pfeifle's "Printing Support in Samba 3.0" manual. Lots of
971 useful tips there! Be sure to look this one up first, before posting questions
972 and problems! Maybe the solution you're looking for is right there.
973 </p>
974
975 </body>
976 </section>
977 </chapter>
978 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20