O'Reilly logo

Security Warrior by Anton Chuvakin, Cyrus Peikari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

File Permissions

Some files are readable by all users, while others are restricted. This is achieved by a system of permissions known as discretionary access control (DAC).[2] Unix flavors use different filesystems (ufs, ext2, and several others), and they all implement the file permissions as follows:

drwx------   2 user 19449        512 Mar 23  2000 bin
-rw-r--r--   1 user 19449      34040 Jun 18 03:10 bookmark.htm

In this example, the directory bin is readable and searchable exclusively by the owner, and only the owner can create new files there. On the other hand, the file bookmark.htm is readable by all users.

The following example shows all possible permissions:

d  rwxt rwx rwx
- type 
   ---- owner
        --- group
             --- others

In this example, "d" is the type of object ("-" is used to denote files, "d" indicates directories, "l" means links, "s" indicates sockets). Permissions are intuitive for files (the owner, group, or others can read, write, and execute a file), but for directories, things can be cryptic. For example, the execute bit for directories means that it is possible to access files in the directory, but not to see the directory listing itself. The latter is controlled by the read bit. In contrast, the write bit allows the creation and removal of files in the directory. To set these permissions, use the Unix command chmod . The typical chmod command line may be in one of two forms: numeric or alphabetic characters. The numeric mode is determined by the 3-digit number (consisting of octal digits), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required