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

📄 ch01_25.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 1] 1.25 Access to Directories </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:31:34Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch01_01.htm"TITLE="1. Introduction"><LINKREL="prev"HREF="ch01_24.htm"TITLE="1.24 The Superuser (Root) "><LINKREL="next"HREF="ch01_26.htm"TITLE="1.26 What a Multiuser System Can Do for You "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_24.htm"TITLE="1.24 The Superuser (Root) "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 1.24 The Superuser (Root) "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 1<BR>Introduction</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_26.htm"TITLE="1.26 What a Multiuser System Can Do for You "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 1.26 What a Multiuser System Can Do for You "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-1016">1.25 Access to Directories </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-2272"></A><ACLASS="indexterm"NAME="AUTOID-2275"></A><ACLASS="indexterm"NAME="AUTOID-2278"></A><ACLASS="indexterm"NAME="AUTOID-2281"></A>UNIX uses the same<SPANCLASS="link">mode bits (<ACLASS="linkend"HREF="ch01_23.htm"TITLE="File Access Permissions ">1.23</A>)</SPAN>for directories as for files, but they are interpreteddifferently. This interpretation will make sense if you remember thata directory is nothing more than a list of files.Creating a file in a directory, renaming a file or deleting a filefrom a directory requires changing thislist: therefore, you need write access to the directory to create ordelete a file.Modifying a file's contents does not require you to change thedirectory; therefore, you can modify files even if you don't havewrite access to the directory (providing that you have write access tothe file).</P><PCLASS="para">Reading a directory is relatively straightforward: you need readaccess to be able to list the contents of a directory (find out whatfiles it contains, etc.). If you don'thave read access, you can't list the contents of the directory.However (surprise!) you can still access files in the directory,provided that you already know their names.</P><PCLASS="para">Execute access for a directory has no meaning per se, so thedesigners of UNIX have reassigned this bit. It is called the<EMCLASS="emphasis">search bit</EM>. Search access is needed to perform any operationwithin a directory and its subdirectories.In other words, if you deny execute access to a directory, you areeffectively denying access to the directory and everything beneath itin the directory tree.</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-2288"></A><ACLASS="indexterm"NAME="AUTOID-2290"></A><ACLASS="indexterm"NAME="AUTOID-2292"></A><ACLASS="indexterm"NAME="AUTOID-2295"></A>The SUID bit is meaningless for directories. However,recent UNIX versions have added a new meaning to the<SPANCLASS="link">SGID bit (<ACLASS="linkend"HREF="ch22_05.htm"TITLE="Group Permissions in a Directory with the setgid Bit ">22.5</A>)</SPAN>and<SPANCLASS="link">sticky bit (<ACLASS="linkend"HREF="ch22_06.htm"TITLE="Protecting Files with the Sticky Bit ">22.6</A>)</SPAN>.</P><PCLASS="para">The exception is that the<SPANCLASS="link">superuser (<ACLASS="linkend"HREF="ch01_24.htm"TITLE="The Superuser (Root) ">1.24</A>)</SPAN>can do absolutely anything at any time.</P><PCLASS="para">Article<ACLASS="xref"HREF="ch22_01.htm#UPT-ART-5010"TITLE="Introduction to File Ownership and Security ">22.1</A>introduces other articles about file and directory access.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">ML</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_24.htm"TITLE="1.24 The Superuser (Root) "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 1.24 The Superuser (Root) "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_26.htm"TITLE="1.26 What a Multiuser System Can Do for You "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 1.26 What a Multiuser System Can Do for You "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">1.24 The Superuser (Root) </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">1.26 What a Multiuser System Can Do for You </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

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