/[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.41 - (show annotations) (download) (as text)
Mon Jan 26 07:30:42 2009 UTC (8 years, 6 months ago) by nightmorph
Branch: MAIN
Changes since 1.40: +18 -16 lines
File MIME type: application/xml
the foomatic metapackage was removed; emerge cups with +ppds, bug 254909

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

  ViewVC Help
Powered by ViewVC 1.1.20