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