/[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.40 - (hide annotations) (download) (as text)
Fri May 2 04:46:22 2008 UTC (6 years, 2 months ago) by nightmorph
Branch: MAIN
Changes since 1.39: +15 -162 lines
File MIME type: application/xml
Now it's just a CUPS/Samba guide, as the samba patches that allowed integration with ClamAV were dropped some time ago, as they don't work/are not maintained. bug 219799

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

  ViewVC Help
Powered by ViewVC 1.1.20