home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 1.24 The Superuser (Root) Chapter 1
Introduction
Next: 1.26 What a Multiuser System Can Do for You
 

1.25 Access to Directories

UNIX uses the same mode bits ( 1.23 ) for directories as for files, but they are interpreted differently. This interpretation will make sense if you remember that a directory is nothing more than a list of files. Creating a file in a directory, renaming a file or deleting a file from a directory requires changing this list: therefore, you need write access to the directory to create or delete a file. Modifying a file's contents does not require you to change the directory; therefore, you can modify files even if you don't have write access to the directory (providing that you have write access to the file).

Reading a directory is relatively straightforward: you need read access to be able to list the contents of a directory (find out what files it contains, etc.). If you don't have 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.

Execute access for a directory has no meaning per se, so the designers of UNIX have reassigned this bit. It is called the search bit . Search access is needed to perform any operation within a directory and its subdirectories. In other words, if you deny execute access to a directory, you are effectively denying access to the directory and everything beneath it in the directory tree.

The SUID bit is meaningless for directories. However, recent UNIX versions have added a new meaning to the SGID bit ( 22.5 ) and sticky bit ( 22.6 ) .

The exception is that the superuser ( 1.24 ) can do absolutely anything at any time.

Article 22.1 introduces other articles about file and directory access.

- ML


Previous: 1.24 The Superuser (Root) UNIX Power Tools Next: 1.26 What a Multiuser System Can Do for You
1.24 The Superuser (Root) Book Index 1.26 What a Multiuser System Can Do for You

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System