File Systems: Protection

Example: Unix

Consider the following output from the "ls -li" command:

2098301 -rwxr-xr-x    2 senning  user       12488 Feb 12 16:09 pipe
2098297 -rw-r--r--    1 senning  user         937 Feb 12 16:08 pipe.c
2098301 -rwxr-xr-x    2 senning  user       12488 Feb 12 16:09 pipe2
2098298 lrwxr-xr-x    1 senning  user           4 Apr  5 22:54 pipe3 -> pipe
7705094 drwxr-xr-x    2 senning  user        4096 Feb 26 23:28 sem
3568549 drwxr-xr-x    2 senning  user          99 Feb 19 09:00 shm
7232144 drwxr-xr-x    2 senning  user          63 Mar  4 16:03 socket

In this example, pipe is an executable file and it is readable, writable and executable by the owner (senning). It is readable and executable by anyone in the group user and also by anyone else on the system. The file pipe.c is only writable by the owner but is readable by everyone. The file pipe2 is a hard link to pipe: as far as Unix is concerned pipe and pipe2 are equivalent. Notice that these two files have the same i-node and that the number just after the protection bits is a 2, indicating that there are two links to this file. The file pipe3 is a symbolic link to pipe. The three remaining entries are subdirectories.