~ubuntu.cat/ubuntaires/ajuda

« back to all changes in this revision

Viewing changes to intrepid/serverguide/C/file-server.xml

  • Committer: Arnau Alcázar Lleopart
  • Date: 2009-07-17 11:09:35 UTC
  • Revision ID: arnau@alcalleop.net-20090717110935-gnslz4lobcm7wj8y
Afegit la traducció de la intrepid

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 
 
3
        "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
 
4
<!ENTITY % globalent SYSTEM "../../libs/global.ent">
 
5
%globalent;
 
6
<!ENTITY % gnome-menus-C SYSTEM "../../libs/gnome-menus-C.ent">
 
7
%gnome-menus-C;
 
8
<!ENTITY % xinclude SYSTEM "../../libs/xinclude.mod">
 
9
%xinclude;
 
10
<!ENTITY language "&EnglishAmerican;">
 
11
]>
 
12
<chapter id="file-servers" status="review">
 
13
        <title>File Servers</title>
 
14
                <!--to write -->
 
15
                <para>
 
16
      If you have more than one computer on a single network.  At some point you will probably
 
17
      need to share files between them.  In this section we cover installing and configuring 
 
18
      FTP, NFS, and CUPS. 
 
19
    </para>
 
20
        <sect1 id="ftp-server" status="review">
 
21
        <title>FTP Server</title> 
 
22
            <para>File Transfer Protocol (FTP) is a TCP protocol for uploading and downloading
 
23
                files between computers. FTP works on a client/server model. The server component is
 
24
                called an <emphasis>FTP daemon</emphasis>. It continuously listens for FTP requests
 
25
                from remote clients. When a request is received, it manages the login and sets up
 
26
                the connection. For the duration of the session it executes any of commands sent by
 
27
                the FTP client.</para>
 
28
            <para>Access to an FTP server can be managed in two ways:</para>
 
29
            <itemizedlist spacing="compact">
 
30
                <listitem>
 
31
                    <para>Anonymous</para>
 
32
                </listitem>
 
33
                <listitem>
 
34
                    <para>Authenticated</para>
 
35
                </listitem>
 
36
            </itemizedlist>
 
37
            <para>In the Anonymous mode, remote clients can access the FTP server by using the
 
38
                default user account called &quot;anonymous&quot; or &quot;ftp&quot; and
 
39
                sending an email address as the password. In the Authenticated mode a user must
 
40
                have an account and a password. User access to the FTP server directories and files is
 
41
                dependent on the permissions defined for the account used at login. As a general
 
42
                rule, the FTP daemon will hide the root directory of the FTP server and change it to
 
43
                the FTP Home directory. This hides the rest of the file system from remote
 
44
            sessions.</para>
 
45
            <sect2 id="vsftpd-ftp-server-installation" status="review">
 
46
                <title>vsftpd - FTP Server Installation</title>
 
47
                    <para>vsftpd is an FTP daemon available in
 
48
                    Ubuntu. It is easy to install, set up, and
 
49
                    maintain.  To install <application>vsftpd</application> you
 
50
                can run the following command:
 
51
                <screen> <command>sudo apt-get install vsftpd</command> </screen>
 
52
                </para>
 
53
 
 
54
                </sect2>
 
55
            <sect2 id="vsftpd-ftp-server-configuration" status="review">
 
56
                <title>vsftpd - FTP Server Configuration</title>
 
57
                <para>
 
58
                You can edit the vsftpd configuration file,
 
59
                <filename>/etc/vsftpd.conf</filename>, to
 
60
                change the default settings.
 
61
 
 
62
                By default only anonymous FTP is
 
63
                allowed. If you wish to disable this option, you
 
64
                should change the following line:
 
65
                </para>
 
66
<programlisting>
 
67
anonymous_enable=YES
 
68
</programlisting>
 
69
                <para>
 
70
                to
 
71
                </para>
 
72
<programlisting>
 
73
anonymous_enable=NO
 
74
</programlisting>
 
75
                <para>
 
76
                By default, local system users are not allowed to
 
77
                login to FTP server. To change this setting, you
 
78
                should uncomment the following line:
 
79
                </para>
 
80
<programlisting>
 
81
#local_enable=YES
 
82
</programlisting>
 
83
                <para>
 
84
                By default, users are allowed to download files
 
85
                from FTP server. They are not allowed to upload
 
86
                files to FTP server. To change this setting, you
 
87
                should uncomment the following line:
 
88
                </para>
 
89
<programlisting>
 
90
#write_enable=YES
 
91
</programlisting>
 
92
                <para>
 
93
                Similarly, by default, the anonymous users are not
 
94
                allowed to upload files to FTP server. To change
 
95
                this setting, you should uncomment the following
 
96
                line:
 
97
                </para>
 
98
<programlisting>
 
99
#anon_upload_enable=YES
 
100
</programlisting>
 
101
                <para>
 
102
                The configuration file consists of many
 
103
                configuration parameters. The information about
 
104
                each parameter is available in the configuration
 
105
                file. Alternatively, you can refer to the man
 
106
                page, <command>man 5 vsftpd.conf</command> for
 
107
                details of each parameter. 
 
108
                </para>
 
109
                <para> 
 
110
                Once you configure <application>vsftpd</application> you
 
111
                can start the daemon. You can run following command to
 
112
                run the <application>vsftpd</application> daemon:
 
113
                </para>
 
114
<screen>
 
115
<command>sudo /etc/init.d/vsftpd start</command>
 
116
</screen>
 
117
                                <note><para>
 
118
                                Please note that the defaults in the configuration file are
 
119
                                set as they are for security reasons.  Each of the above
 
120
                                changes makes the system a little less secure, so make them
 
121
                                only if you need them.
 
122
                                </para></note>
 
123
                </sect2>
 
124
    </sect1>
 
125
        <sect1 id="network-file-system" status="review">
 
126
                <title>Network File System (NFS)</title>
 
127
          <para>
 
128
          NFS allows a system to share directories and files with others
 
129
          over a network. By using NFS, users and programs can access
 
130
          files on remote systems almost as if they were local files.
 
131
          </para>
 
132
 
 
133
          <para>
 
134
          Some of the most notable benefits that NFS can provide are:
 
135
          </para>
 
136
 
 
137
          <itemizedlist>
 
138
          <listitem>
 
139
      <para>Local workstations use less disk space because commonly used data
 
140
can be stored on a single machine and still remain accessible to others
 
141
over the network.</para>
 
142
          </listitem>
 
143
          <listitem>
 
144
      <para>There is no need for users to have separate home directories on
 
145
every network machine. Home directories could be set up on the NFS
 
146
server and made available throughout the network.</para>
 
147
          </listitem>
 
148
          <listitem>
 
149
 
 
150
      <para>Storage devices such as floppy disks, CDROM drives, and USB
 
151
Thumb drives can be used by other machines on the network. This may
 
152
reduce the number of removable media drives throughout the
 
153
network.</para>
 
154
          </listitem>
 
155
          </itemizedlist>
 
156
 
 
157
      <sect2 id="nfs-installation" status="review">
 
158
        <title>Installation</title>
 
159
      
 
160
          <para>
 
161
          At a terminal prompt enter the following command to install the NFS
 
162
          Server:
 
163
          </para>
 
164
          <para>
 
165
<screen>
 
166
<command>sudo apt-get install nfs-kernel-server</command>
 
167
</screen>
 
168
          </para>
 
169
      </sect2>
 
170
      <sect2 id="nfs-configuration" status="review">
 
171
        <title>Configuration</title>
 
172
          <para>
 
173
          You can configure the directories to be exported by adding them to
 
174
          the <filename>/etc/exports</filename> file. For example:
 
175
          </para>
 
176
          <para>
 
177
<screen>
 
178
/ubuntu  *(ro,sync,no_root_squash)
 
179
/home    *(rw,sync,no_root_squash)
 
180
</screen>
 
181
          </para>
 
182
 
 
183
          <para>
 
184
          You can replace * with one of the hostname formats. Make the
 
185
          hostname declaration as specific as possible so unwanted
 
186
          systems cannot access the NFS mount.
 
187
          </para>
 
188
 
 
189
          <para>
 
190
          To start the NFS server, you can run the following command at a terminal prompt:
 
191
          </para>
 
192
          <para>
 
193
<screen>
 
194
<command>sudo /etc/init.d/nfs-kernel-server start</command>
 
195
</screen>
 
196
          </para>
 
197
      </sect2>
 
198
      <sect2 id="nfs-client-configuration" status="review">
 
199
        <title>NFS Client Configuration</title>
 
200
          <para>
 
201
          Use the <application>mount</application> command to mount a shared NFS directory from
 
202
          another machine, by typing a command line similar to the following at a terminal prompt:
 
203
          </para>
 
204
          <para>
 
205
<screen>
 
206
<command>sudo mount example.hostname.com:/ubuntu /local/ubuntu</command>
 
207
</screen>
 
208
</para>
 
209
      <warning>
 
210
      <para>
 
211
      The mount point directory <filename>/local/ubuntu</filename> must
 
212
      exist. There should be no files or subdirectories in the
 
213
      <filename>/local/ubuntu</filename> directory.
 
214
      </para>
 
215
      </warning>
 
216
 
 
217
      <para>
 
218
       An alternate way to mount an NFS share from another machine is to
 
219
       add a line to the <filename>/etc/fstab</filename> file. The line must state the
 
220
       hostname of the NFS server, the directory on the server being
 
221
       exported, and the directory on the local machine where the NFS
 
222
       share is to be mounted.
 
223
      </para>
 
224
 
 
225
      <para>
 
226
      The general syntax for the line in <filename>/etc/fstab</filename>
 
227
      file is as follows:
 
228
      </para>
 
229
      
 
230
      <para>
 
231
<programlisting>
 
232
example.hostname.com:/ubuntu /local/ubuntu nfs rsize=8192,wsize=8192,timeo=14,intr
 
233
</programlisting>
 
234
      </para>
 
235
          <para>
 
236
          If you have trouble mounting an NFS share, make sure the <application>nfs-common</application> package is 
 
237
          installed on your client.  To install
 
238
          <application>nfs-common</application> enter the following
 
239
          command at the terminal
 
240
          prompt:
 
241
<screen>
 
242
<command>sudo apt-get install nfs-common</command>
 
243
</screen>
 
244
          </para>
 
245
      </sect2>
 
246
      <sect2 id="nfs-references" status="review">
 
247
        <title>References</title>
 
248
                                <para><ulink url="http://nfs.sourceforge.net/">Linux NFS faq</ulink></para>
 
249
      </sect2>
 
250
    </sect1>
 
251
 
 
252
        <sect1 id="cups" status="review">
 
253
                <title>CUPS - Print Server</title>
 
254
          <para>
 
255
            The primary mechanism for Ubuntu printing and print services is the 
 
256
                        <emphasis role="bold">Common UNIX Printing System</emphasis> (CUPS). 
 
257
                        This printing system is a freely available, portable printing layer 
 
258
                        which has become the new standard for printing in most Linux 
 
259
                        distributions.
 
260
          </para>
 
261
          <para>
 
262
          CUPS manages print jobs and queues and provides network printing using 
 
263
                  the standard Internet Printing Protocol (IPP), while offering support 
 
264
                  for a very large range of printers, from dot-matrix to laser and many 
 
265
                  in between.  CUPS also supports PostScript Printer Description (PPD) and 
 
266
                  auto-detection of network printers, and features a simple web-based 
 
267
                  configuration and administration tool. 
 
268
          </para>
 
269
      <sect2 id="cups-installation" status="review">
 
270
        <title>Installation</title>
 
271
          <para>
 
272
            To install CUPS on your Ubuntu computer, simply use <application>sudo</application> with the <application>apt-get</application> command and give the packages to install as the first parameter. A complete CUPS install has many package dependencies, but they may all be specified on the same command line.  Enter the following at a terminal prompt to install CUPS:
 
273
          </para>
 
274
          <para>
 
275
<screen>
 
276
<command>sudo apt-get install cupsys</command>
 
277
</screen>
 
278
          </para>
 
279
          <para>
 
280
          Upon authenticating with your user password, the packages should be downloaded
 
281
                  and installed without error. Upon the conclusion of installation, the CUPS server 
 
282
                  will be started automatically. 
 
283
          </para>
 
284
          <para>
 
285
          For troubleshooting purposes, you can access CUPS 
 
286
                  server errors via the error log file at: <filename>/var/log/cups/error_log</filename>.
 
287
                  If the error log does not show enough information to troubleshoot any problems you
 
288
                  encounter, the verbosity of the CUPS log can be increased by changing the <emphasis
 
289
                  role="bold">LogLevel</emphasis> directive in the configuration file (discussed below)
 
290
                  to "debug" or even "debug2", which logs everything, from the default of "info".  If 
 
291
                  you make this change, remember to change it back once you've solved your problem, to 
 
292
                  prevent the log file from becoming overly large.
 
293
          </para>
 
294
      </sect2>
 
295
      <sect2 id="cups-configuration" status="review">
 
296
        <title>Configuration</title>
 
297
          <para>
 
298
            The Common UNIX Printing System server's behavior is configured through the 
 
299
                        directives contained in the file <filename>/etc/cups/cupsd.conf</filename>.  
 
300
                        The CUPS configuration file follows the same syntax as the primary configuration 
 
301
                        file for the Apache HTTP server, so users familiar with editing Apache's 
 
302
                        configuration file should feel at ease when editing the CUPS configuration 
 
303
                        file. Some examples of settings you may wish to change initially will be 
 
304
                        presented here.
 
305
          </para>
 
306
          <tip>
 
307
               <para>Prior to editing the configuration file, you should make a copy of 
 
308
                           the original file and protect it from writing, so you will have the original 
 
309
                           settings as a reference, and to reuse as necessary.
 
310
               </para>
 
311
               <para>Copy the <filename>/etc/cups/cupsd.conf</filename> file and protect it 
 
312
                           from writing with the following commands, issued at a terminal prompt:
 
313
               </para>
 
314
               </tip>
 
315
               <para>
 
316
<screen>
 
317
<command>sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original</command>
 
318
<command>sudo chmod a-w /etc/cups/cupsd.conf.original</command>
 
319
</screen>
 
320
               </para>
 
321
          <itemizedlist>
 
322
                <listitem>
 
323
                <para>
 
324
                <emphasis role="bold">ServerAdmin</emphasis>: To configure the email 
 
325
                                address of the designated administrator of the CUPS server, simply 
 
326
                                edit the <filename>/etc/cups/cupsd.conf</filename> configuration file 
 
327
                                with your preferred text editor, and modify the <emphasis 
 
328
                                role="italics">ServerAdmin</emphasis> line accordingly.  For example, 
 
329
                                if you are the Administrator for the CUPS server, and your e-mail 
 
330
                                address is 'bjoy@somebigco.com', then you would modify the ServerAdmin 
 
331
                                line to appear as such:
 
332
                </para>
 
333
                <para>
 
334
<screen>
 
335
ServerAdmin bjoy@somebigco.com
 
336
</screen>
 
337
                </para>
 
338
                </listitem>
 
339
          </itemizedlist>
 
340
                <para>
 
341
                For more examples of configuration directives in the CUPS server 
 
342
                                configuration file, view the associated system manual page by entering the 
 
343
                                following command at a terminal prompt:
 
344
               </para>
 
345
               <para>
 
346
<screen>
 
347
<command>man cupsd.conf</command>
 
348
</screen>
 
349
               </para>
 
350
                               <note>
 
351
                <para>
 
352
                Whenever you make changes to the <filename>/etc/cups/cupsd.conf</filename> configuration file, you'll need to restart the CUPS server by typing the following command at a terminal prompt:
 
353
                </para>
 
354
                </note>
 
355
                <para>
 
356
<screen>
 
357
<command>sudo /etc/init.d/cupsys restart</command>
 
358
</screen>
 
359
                </para>
 
360
        <para>Some other configuration for the CUPS server is done in the file <filename>/etc/cups/cups.d/ports.conf</filename>:</para>
 
361
          <itemizedlist>
 
362
                <listitem>
 
363
                <para>
 
364
                <emphasis role="bold">Listen</emphasis>: By default on Ubuntu, the CUPS 
 
365
                                server installation listens only on the loopback interface at IP address 
 
366
                                <emphasis>127.0.0.1</emphasis>. In order to instruct the 
 
367
                                CUPS server to listen on an actual network adapter's IP address, you must 
 
368
                                specify either a hostname, the IP address, or optionally, an IP 
 
369
                                address/port pairing via the addition of a Listen directive.  For example, 
 
370
                                if your CUPS server resides on a local network at the IP address <emphasis 
 
371
                                role="italics">192.168.10.250</emphasis> and you'd like to make it 
 
372
                                accessible to the other systems on this subnetwork, you would edit the 
 
373
                                <filename>/etc/cups/cupsd.conf</filename> and add a Listen 
 
374
                                directive, as such:
 
375
                </para>
 
376
                <para>
 
377
<screen>
 
378
Listen 127.0.0.1:631           # existing loopback Listen
 
379
Listen /var/run/cups/cups.sock # existing socket Listen
 
380
Listen 192.168.10.250:631      # Listen on the LAN interface, Port 631 (IPP)
 
381
</screen>
 
382
                </para>
 
383
                <para>
 
384
                In the example above, you may comment out or remove the reference to the 
 
385
                                Loopback address (127.0.0.1) if you do not wish <application>cupsd
 
386
                                </application> to listen on that interface, but would rather have it only 
 
387
                                listen on the Ethernet interfaces of the Local Area Network (LAN). To enable 
 
388
                                listening for all network interfaces for which a certain hostname is bound, 
 
389
                                including the Loopback, you could create a Listen entry for the hostname 
 
390
                                <emphasis>socrates</emphasis> as such:
 
391
                </para>
 
392
                <para>
 
393
<screen>
 
394
Listen socrates:631  # Listen on all interfaces for the hostname 'socrates'
 
395
</screen>
 
396
                </para> 
 
397
                                <para>or by omitting the Listen directive and using <emphasis>Port</emphasis> instead, as in:</para>
 
398
<para>
 
399
<screen>
 
400
Port 631  # Listen on port 631 on all interfaces
 
401
</screen>
 
402
</para>
 
403
                </listitem>
 
404
        </itemizedlist>
 
405
 
 
406
      </sect2>
 
407
      <sect2 id="cups-references" status="review">
 
408
        <title>References</title>
 
409
        <para>
 
410
        <ulink url="http://www.cups.org/">CUPS Website</ulink>
 
411
        </para>
 
412
        </sect2>
 
413
    </sect1>
 
414
 
 
415
</chapter>
 
416