📄 ch22_01.htm
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 22] File Security, Ownership, and Sharing</TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly & Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly & Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:40:20Z"><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="part03.htm"TITLE="III. Working with the Filesystem "><LINKREL="prev"HREF="ch21_14.htm"TITLE="21.14 Automatically Appending the Date to a Filename "><LINKREL="next"HREF="ch22_02.htm"TITLE="22.2 Tutorial on File and Directory Permissions "></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="ch21_14.htm"TITLE="21.14 Automatically Appending the Date to a Filename "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 21.14 Automatically Appending the Date to a Filename "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 22</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch22_02.htm"TITLE="22.2 Tutorial on File and Directory Permissions "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 22.2 Tutorial on File and Directory Permissions "BORDER="0"></A></TD></TR></TABLE> <HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="CHAPTER"><H1CLASS="chapter"><ACLASS="title"NAME="UPT-CHP-22">22. File Security, Ownership, and Sharing</A></H1><DIVCLASS="htmltoc"><P><B>Contents:</B><BR><ACLASS="sect1"HREF="#UPT-ART-5010"TITLE="22.1 Introduction to File Ownership and Security ">Introduction to File Ownership and Security </A><BR><ACLASS="sect1"HREF="ch22_02.htm"TITLE="22.2 Tutorial on File and Directory Permissions ">Tutorial on File and Directory Permissions </A><BR><ACLASS="sect1"HREF="ch22_03.htm"TITLE="22.3 Who Will Own a New File? ">Who Will Own a New File? </A><BR><ACLASS="sect1"HREF="ch22_04.htm"TITLE="22.4 Setting an Exact umask ">Setting an Exact umask </A><BR><ACLASS="sect1"HREF="ch22_05.htm"TITLE="22.5 Group Permissions in a Directory with the setgid Bit ">Group Permissions in a Directory with the setgid Bit </A><BR><ACLASS="sect1"HREF="ch22_06.htm"TITLE="22.6 Protecting Files with the Sticky Bit ">Protecting Files with the Sticky Bit </A><BR><ACLASS="sect1"HREF="ch22_07.htm"TITLE="22.7 Using chmod to Change File Permission ">Using chmod to Change File Permission </A><BR><ACLASS="sect1"HREF="ch22_08.htm"TITLE="22.8 The Handy chmod = Operator ">The Handy chmod = Operator </A><BR><ACLASS="sect1"HREF="ch22_09.htm"TITLE="22.9 Protect Important Files: Make Them Unwritable ">Protect Important Files: Make Them Unwritable </A><BR><ACLASS="sect1"HREF="ch22_10.htm"TITLE="22.10 cx, cw, c-w: Quick File Permission Changes ">cx, cw, c-w: Quick File Permission Changes </A><BR><ACLASS="sect1"HREF="ch22_11.htm"TITLE="22.11 A Loophole: Modifying Files Without Write Access">A Loophole: Modifying Files Without Write Access</A><BR><ACLASS="sect1"HREF="ch22_12.htm"TITLE="22.12 A Directory that People Can Access but Can't List ">A Directory that People Can Access but Can't List </A><BR><ACLASS="sect1"HREF="ch22_13.htm"TITLE="22.13 Groups and Group Ownership ">Groups and Group Ownership </A><BR><ACLASS="sect1"HREF="ch22_14.htm"TITLE="22.14 Add Users to a Group to Deny Permission ">Add Users to a Group to Deny Permission </A><BR><ACLASS="sect1"HREF="ch22_15.htm"TITLE="22.15 Juggling Permissions ">Juggling Permissions </A><BR><ACLASS="sect1"HREF="ch22_16.htm"TITLE="22.16 Copying Permissions with cpmod ">Copying Permissions with cpmod </A><BR><ACLASS="sect1"HREF="ch22_17.htm"TITLE="22.17 Ways of Improving the Security of crypt ">Ways of Improving the Security of crypt </A><BR><ACLASS="sect1"HREF="ch22_18.htm"TITLE="22.18 Clear Your Terminal for Security, to Stop Burn-in ">Clear Your Terminal for Security, to Stop Burn-in </A><BR><ACLASS="sect1"HREF="ch22_19.htm"TITLE="22.19 Shell Scripts Must be Readable and (Usually) Executable">Shell Scripts Must be Readable and (Usually) Executable</A><BR><ACLASS="sect1"HREF="ch22_20.htm"TITLE="22.20 Why Can't You Change File Ownership Under BSD UNIX?">Why Can't You Change File Ownership Under BSD UNIX?</A><BR><ACLASS="sect1"HREF="ch22_21.htm"TITLE="22.21 How to Change File Ownership Without chown">How to Change File Ownership Without chown</A><BR><ACLASS="sect1"HREF="ch22_22.htm"TITLE="22.22 The su Command Isn't Just for the Superuser ">The su Command Isn't Just for the Superuser </A></P><P></P></DIV><DIVCLASS="sect1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-5010">22.1 Introduction to File Ownership and Security </A></H2><PCLASS="para">Because UNIX is a multiuser system, you need some way of protectingusers from one another: you don't want other users to look at the wrongfiles and find out compromising information about you, or raisetheir salaries, or something equivalently antisocial.Even ifyou're on a single-user system, file ownership still has value: itcan often protect you from making mistakes, like deleting importantexecutables.</P><PCLASS="para">In this chapter, we'll describe how file ownership works: who ownsfiles, how to change ownership, how to specify which kinds of fileaccess are allowed, and so on.We'll also discuss some otherways to prevent people from "prying," like encryption and clearingyour screen.</P><PCLASS="para">In my opinion, most security breaches arise frommistakes that could easily have been avoided: someone discovers that<EMCLASS="emphasis">anyone</EM> can read the boss's email, including the messages to hisbookie.Once you've read this chapter, you'll understand how to avoidthe common mistakes and protect yourself from most intruders.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">ML</SPAN></P></DIV></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="ch21_14.htm"TITLE="21.14 Automatically Appending the Date to a Filename "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 21.14 Automatically Appending the Date to a Filename "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="ch22_02.htm"TITLE="22.2 Tutorial on File and Directory Permissions "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 22.2 Tutorial on File and Directory Permissions "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">21.14 Automatically Appending the Date to a Filename </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">22.2 Tutorial on File and Directory Permissions </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 & 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 + -