Page 161 - DCAP106_OPERATING_SYSTEM_TOOLS
P. 161

Operating System Tools




                    Notes
                                       !
                                     Caution People in the root group have view- and enter rights (r-x). On the other hand,  all
                                     other people have no rights to view, write or enter the directory (---).
                                   In order to view the privileges on a file, the long listing format support of the ls command can
                                   be used.


                                          Example: To view the permissions on the systems’ passwd file (which contains the user
                                   account information):

                                   $ ls -l /etc/passwd
                                   -rw-r--r-- 1 root root 3108 Dec 26 14:41 /etc/passwd
                                   This file’s permissions are read/write rights for the root user and read rights for everybody else.
                                   The first character in the permission output shows the type of the file:

                                   z z  ‘-’: regular file
                                   z z  ‘d’: a directory
                                   z z  ‘l’: a symbolic link

                                   z z  ‘b’: a block device (like /dev/sda1)
                                   z z  ‘c’: a character device (like /dev/console)
                                   z z  ‘p’: a named pipe
                                   z z  ‘s’: a unix domain socket
                                   The remaining permission output is divided in three parts:

                                   z z  one for the file owner,
                                   z z  one for the file owning group, and
                                   z z  one for all the rest.
                                   So, in the given example, we can read the output ‘-rw-r--r--’ as:
                                   1.   the file is a regular file.
                                   2.   the owner (root - see third field of the output) has read-write rights.

                                   3.   the members of the owning group (also root - see fourth field of the output) have read
                                       rights.
                                   4.   everybody else has read rights.


                                          Example: Another example would be the privileges of the /var/log/sandbox directory.
                                   In this case, we also use ls’ -d argument to make sure ls shows the information on the directory
                                   rather than its contents:
                                   $ ls -ld /var/log/sandbox
                                   drwxrwx--- 2 root portage 4096 Jul 14 18:47 /var/log/sandbox
                                   In this case:
                                   z z  the file is a directory
                                   z z  the owner (root) has read, write and execute rights






          154                              LOVELY PROFESSIONAL UNIVERSITY
   156   157   158   159   160   161   162   163   164   165   166