CS 279 - Week 2 Lecture 2 - August 30, 2012

NOTE AFTER CLASS:
********
ps x
********
...THAT's the option for ps/process status that lets you see all of
   the processes YOU own, even if they aren't from your current shell
   session!!!!
   *   (this is the version that is very useful if you need to kill
       a process from an accidentally terminated shell session or to kill
       a process running amok such that you can't kill it from its
       "home" shell session,
       
       so that you can get its process ID to use in a kill command...)

Playing with symbolic mode to modify a set of permissions

*   reference: Section 2.8.3, "Unix for the Impatient", 2nd edition

ugo - u user (owner)
      g group
      o others ("world" - others who have 
                accounts on that system

      a - all - everyone, u and g and o
          (equiv to saying ugo)

*   to use symbolic mode to specify how to
    modify a set of permissions:

    [below is mostly quoted from Section 2.8.3
    of "Unix for the Impatient"]

    *   consists of 1 or more clauses separated
        by commas
    *   each clause consists of 0 or more "who"
        letters followed by a sequence of one
        or more actions to be applied to the
	categories designated by the "who" 
        letters
    *   the effect of that set of clauses
        is achieved by executing in sequence
        the actions of each clause

*   "who" letters: u g o and a (as defined 
    above)

*   you CAN omit the "who" letters preceding
    the operator,
    and the result is that a (or ugo) is assumed
    AND the file creation mask (section 2.8.5)
    is applied to reduce the permissions as
    they would be reduced for a newly created
    file

*   here are the operators:
    + 	     add these permissions
    -	     take away these permissions
    =        set exactly these permissions,
             removing any others for the
	     indicated "who" letters

*   here are the permissions:
    r	     read
    w	     write
    x        execute
    X        execute ONLY if the file is a 
             directory OR some x permissio
             is already set for u, g, or o
    s        set user or group ID
    t        sticky bit

*   if you type a "who" letter AFTER an
    operator,
    then a copy of the permissions 
    currently associated with the specified
    "who" letter are used

*   a + or - operator followed by nothing
    has NO effect
    BUT an = operator followed by nothing
    has the effect of CLEARING the permissions
    for those sets specified by the "who"
    letters

starting perms    symbolic mode    final perms
-----------------------------------------------
----------        a=rw             -rw-rw-rw-
-rw-------        go+r             -rw-r--r--
-rwxrwxrwx        a-x              -rw-rw-rw-
-rwxrwxrwx        g-w,o-wx         -rwxr-xr--
-rwxrwx---        o=g              -rwxrwxrwx
-rwxrwx---        o=g-xw           -rwxrwxr--
-rwxrw-rw-        g+X              -rwzrwxrw-
drw-rw-rw-        a+X              drwxrwxrwx
-rw-rw-rw-        a+X              -rw-rw-rw-
-rw-rwxrw-        a+X              -rwxrwxrwx

-rw-rw---x        o+u              -rw-rw-rwx
-rwxrwxrwx        a-x,u+x          -rwxrw-rw-