Fourth day in Addis

Unix file permissions:

    drwxr-xr-x   2 root root    38 2006-07-14
    |
    +- Is a directory

    drwxr-xr-x   2 root root    38 2006-07-14
     ---
      |
      +- User permissions (u)

    drwxr-xr-x   2 root root    38 2006-07-14
        ---
         |
         +- Group permissions (g)

    drwxr-xr-x   2 root root    38 2006-07-14
           ---
            |
            +- Permissions for others (o)

    drwxr-xr-x   2 root root    38 2006-07-14
                   ----
                    |
                    +- Owner user

    drwxr-xr-x   2 root root    38 2006-07-14
                        ----
                         |
            Owner group -+

Other bits:

The executable bit for directories means "can access the files in the directory".

If a directory is readable but not executable, then I can see the list of files (with ls) but I cannot access the files.

To access a file, all the directories of its path up to / need to be executable.

Commands to manipulate permissions:

Example setup for a website for students:

    # Create the group 'students'
    mkdir /var/www/students
    chgrp students /var/www/students
    chmod 2775 /var/www/students

    # If you don't want other users to read the files of the students:

    chmod 2770 /var/www/students
    adduser www-data students
     (this way the web server can read the
      pages)

    # when you add a user to a group, it does not affect running processes:

     - users need to log out and in again
     - servers need to be restarted

Apache:

in /etc/apache/apache2.conf (set it to your IP address)

Apache troubleshooting:

This it is always a good thing to do before restarting or reloading apache.

To install PHP

To install MySQL

To use MySQL from PHP:

    apt-get install php5-mysqli php5-mysql

Problems found today: