Page 193 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 193

Unit 10: File System




          2.   w write                                                                          notes
          3.   x execute

          In the following examples, the chmod command is given together with the old and new modes
          for the files concerned.
          Here is a table of numbers that covers all the common settings. The ones beginning with “7” are
          used with programs (since they enable execution) and the rest are for other kinds of files.
            value                               meaning
           777    (rwxrwxrwx):  No  restrictions  on  permissions.  Anybody  may  do  anything.  Generally  not  a
                  desirable setting.
           755    (rwxr-xr-x): The file’s owner may read, write, and execute the file. All others may read and
                  execute the file. This setting is common for programs that are used by all users.
           700    (rwx------): The file’s owner may read, write, and execute the file. Nobody else has any rights.
                  This setting is useful for programs that only the owner may use and must be kept private from
                  others.
           666    (rw-rw-rw-): All users may read and write the file.
           644    (rw-r--r--): The owner may read and write a file, while all others may only read the file. A
                  common setting for data files that everybody may read but only the owner may change.
           600    (rw-------): The owner may read and write a file. All others have no rights. A common setting
                  for data files that the owner wants to keep private.
          The chmod command can also be used to control the access permissions for directories. In most
          ways, the permissions scheme for directories works the same way as with files. However, the
          execution permission is used in a different way. It provides control for access to file listing and
          other things. Here are some useful settings for directories:

           value                                meaning
           777   (rwxrwxrwx):  No  restrictions  on  permissions.  Anybody  may  list  files,  create  new  files  in  the
                 directory and delete files in the directory. Generally not a good setting.
           755   (rwxr-xr-x): The directory owner has full access. All others may list the directory but cannot create
                 files nor delete them. This setting is common for directories that you wish to share with other
                 users.
           700   (rwx------): The directory owner has full access. Nobody else has any rights. This setting is useful
                 for directories that only the owner may use and must be kept private from others.


                 Example:
          Given a file ‘file1’ with the default access modes (read and write for the user), add read mode for
          the group:
          bash$ chmod g+r file1

          user group others
          Before: rw- --- ---
          After: rw- r-- ---
          Remove  read  and  write  access  for  everyone  else  from  file  ‘file2’  (showing  that  you  can  use
          multiple permissions):
          bash$ chmod o-rw file2
          user group others
          Before: rwx rw- rw-
          After: rwx rw- ---




                                           LoveLy professionaL university                                   187
   188   189   190   191   192   193   194   195   196   197   198