Contents / Previous / Next


Changing File Parameters


su: Switch user.

Example:

> su root


whoami: Who am I ?


chmod: Changing File Permissions

Example:

   chmod a=r,u+w somefile

Explanation:

 u   user (owner) permissions
 g   group permissions
 o   others (public) permissions
 a   all of user, group and others permissions
 =   assign a permission absolutely
 +   add a permission
 -   take away a permission


umask: seting default file permissions.

The mask must be given in octal representation:


Example:

> umask 644

Explanation:

            400
            200
             40
              4
            ---
            644

644 is rw-r--r--
                 the owner can read and write the file or
                 directory, everybody else can only read it.


Octal numbers corresponding to some common permissions:

755 is rwxr-xr-x
                 the owner can read, write, and execute the 
                 file, everybody else can read or execute it.  
                 For a directory, this mode is equivalent to 
                 644

711 is rwx--x--x
                 the owner can read, write, and execute the 
                 file, everybody else can only execute it.

444 is r--r--r--
                 this permission implies read-only for everybody.


chown: Change file owner and group.

       chown [OPTION]... OWNER[:[GROUP]] FILE...
       chown [OPTION]... :GROUP FILE...

Options:

   -R, --recursive : operate on files and directories recursively

Example:

chown -R felix:users ~/*