⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 275-278.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Special Edition Using Linux, Fourth Edition:Managing File Systems</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0789717468//-->

<!--TITLE=Special Edition Using Linux, Fourth Edition//-->

<!--AUTHOR=Jack Tackett//-->

<!--AUTHOR=Jr.//-->

<!--AUTHOR=Steve Burnett//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Que//-->

<!--CHAPTER=14//-->

<!--PAGES=275-278//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="273-275.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="278-280.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading9"></A><FONT COLOR="#000077">Understanding the /etc/exports File</FONT></H4>

<P>The /etc/exports file is used by the <TT>mountd</TT> and <TT>nfsd</TT> daemons to determine what file systems are to be exported and what restrictions are placed on them. File systems are listed in /etc/exports, one per line. The format of each line is the name of the mount point for a local file system, followed by a list of computers that are allowed to mount this file system. A comma-separated list of mount options in parentheses may follow each name in the list. Table 14.5 lists the mount options available in the /etc/exports file.</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 14.5</B> Mount Options Available in the /etc/exportsb File

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TH WIDTH="25%" ALIGN="LEFT">Option

<TH WIDTH="75%" ALIGN="LEFT">Description

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TD><TT>insecure</TT>

<TD>Permits non-authenticated access from this machine.

<TR>

<TD><TT>secure</TT>

<TD>Requires secure RPC authentication from this machine.

<TR>

<TD VALIGN="TOP"><TT>root_squash</TT>

<TD>Maps any requests from root, <TT>UID 0</TT> on the client, to the <TT>UID NOBODY_UID</TT> on the server.

<TR>

<TD><TT>no_root_squash</TT>

<TD>Doesn&#146;t map any requests from <TT>UID 0</TT> (default behavior).

<TR>

<TD><TT>ro</TT>

<TD>Mounts the file system as read-only (default behavior).

<TR>

<TD><TT>rw</TT>

<TD>Mounts the file system as read-write.

<TR>

<TD VALIGN="TOP"><TT>link_relative</TT>

<TD>Converts absolute symbolic links (where the link contents start with a slash) into relative links by prefixing the link with the necessary number of <TT>../</TT> characters to get from the directory containing the link to the root on the server.

<TR>

<TD VALIGN="TOP"><TT>link_absolute</TT>

<TD>Leaves all symbolic links as they are (normal behavior for Sun NFS servers). This is the default behavior for Linux.

<TR>

<TD VALIGN="TOP"><TT>map_daemon</TT>

<TD>Maps local and remote names and numeric IDs by using an <TT>lname/uid map</TT> daemon on the client where the NFS request originated. Used to map between the client and server UID spaces.

<TR>

<TD VALIGN="TOP"><TT>all-squash</TT>

<TD>Maps all UIDs and GIDs to the anonymous user. This option is useful for NFS-exported public directories, such as those housing FTP and news.

<TR>

<TD VALIGN="TOP"><TT>no-all-squash</TT>

<TD>The opposite of the <TT>all-squash</TT> option. This is the default option for Linux.

<TR>

<TD VALIGN="TOP"><TT>squash-uids</TT>

<TD>Specifies a list of UIDs subject to anonymous mappings. A valid list of IDs looks like this:

<TR>

<TD>

<TD><TT>squash uids=0-15,20,25-50</TT>

<TR>

<TD VALIGN="TOP"><TT>squash-gids</TT>

<TD>Specifies a list of GIDs subject to anonymous mappings. A valid list of IDs looks like this:

<TR>

<TD>

<TD><TT>squash gids=0-15,20,25-50</TT>

<TR>

<TD VALIGN="TOP"><TT>anonuid</TT>

<TD>Sets the UID for the anonymous account. This option is useful for PC/NFS clients.

<TR>

<TD VALIGN="TOP"><TT>anongid</TT>

<TD>Sets the GID for the anonymous account. This option is useful for PC/NFS clients.

<TR>

<TD VALIGN="TOP"><TT>noaccess</TT>

<TD>Used to exclude certain subdirectories from a client. Makes everything below the directory inaccessible to the client.

<TR>

<TD COLSPAN="2"><HR>

</TABLE>

<P>Here is a sample <TT>/etc/exports</TT> file:</P>

<!-- CODE SNIP //-->

<PRE>

/home               bill.tristar.com(rw) fred.tristar.com(rw)

george.tristar.com(rw)

/usr/local/bin/bin          *.tristar.com(ro)

/projects           develop.tristar.com(rw) bill.tristar.com(ro)

/pub                (ro,insecure,root_squash)

</PRE>

<!-- END CODE SNIP //-->

<P>In this example, the server exports four different file systems. /home is mounted with read/write access on three different computers: bill, fred, and george. This indicates the directory probably holds user home directories because of the directories&#146; names. The /usr/local/bin file system is exported as read-only with access allowed for every computer in the tristar.com domain.

</P>

<P>The /projects file system is exported with read/write access for the computer develop.tristar.com but with read-only access for bill.tristar.com.</P>

<P>For the /pub file system, there&#146;s no list of hosts that are allowed access. This means that any host is allowed to mount this file system. It has been exported as read-only with non-authenticated access allowed, and the server remaps any request from root on a remote machine that accesses this file system.</P>

<H4 ALIGN="LEFT"><A NAME="Heading10"></A><FONT COLOR="#000077">Mounting NFS File Systems</FONT></H4>

<P>Mounting an NFS file system is similar to mounting any other type of file system. You can mount NFS file systems from the /etc/fstab file at boot time or interactively via the <TT>mount</TT> command.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>CAUTION:&nbsp;&nbsp;</B><BR>You must be sure to separate the host name and <TT>file</TT>/<TT>system</TT>/<TT>path</TT> portions of the remote file system name with a colon, such as

<!-- CODE SNIP //-->

<PRE>

mailserver:/var/spool/mail

</PRE>

<!-- END CODE SNIP //-->

<P>when using the <TT>mount</TT> command or when making an entry in /etc/fstab. If you don&#146;t separate the host name from the directory, your system won&#146;t mount the remote directory correctly.<HR></FONT>

</BLOCKQUOTE>

</P>

<P><FONT SIZE="+1"><B>Mounting NFS File Systems via /etc/fstab</B></FONT></P>

<P>When you specify an NFS file system in the /etc/fstab file, you identify the file system with the format

</P>

<!-- CODE SNIP //-->

<PRE>

<I>hostname: /file/system path</I>

</PRE>

<!-- END CODE SNIP //-->

<P>where <I>hostname</I> is the name of the server where the file system is located, and /<I>file</I>/<I>system</I>/<I>path</I> is the file system on the server.</P>

<P>The file-system type is specified as <TT>nfs</TT> in the mount options field of the file system entry. Table 14.6 lists the most commonly used <TT>mount</TT> options.</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 14.6</B> Commonly Used Options for NFS Mounts

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TH WIDTH="15%" ALIGN="LEFT">Option

<TH WIDTH="85%" ALIGN="LEFT">Description

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TD VALIGN="TOP"><TT>rsize=<I>n</I></TT>

<TD>Specifies the datagram size in bytes used by the NFS clients on read requests. The default value is 1,024 bytes.

<TR>

<TD VALIGN="TOP"><TT>wsize=<I>n</I></TT>

<TD>Specifies the datagram size in bytes used by the NFS clients on write requests. The default value is 1,024 bytes.

<TR>

<TD VALIGN="TOP"><TT>timeo=<I>n</I></TT>

<TD>Sets the time, in tenths of a second, that the NFS client waits for a request to complete. The default value is 0.7 seconds.

<TR>

<TD VALIGN="TOP"><TT>hard</TT>

<TD>Mounts this file system by using a hard mount. This is the default behavior.

<TR>

<TD><TT>soft</TT>

<TD>Mounts this file system by using a soft mount.

<TR>

<TD VALIGN="TOP"><TT>intr</TT>

<TD>Allows signals to interrupt an NFS call. This is useful for aborting an operation when an NFS server doesn&#146;t respond.

<TR>

<TD COLSPAN="2"><HR>

</TABLE>

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="273-275.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="278-280.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -