Joomla! 1.5 Cookbook
上QQ阅读APP看书,第一时间看更新

Ensuring permissions are correct

In any computer, files and programs have a 'permission' level, meaning it states who can read, write, change, or run them. In Joomla! (Linux-based machines) we have three sets of permissions: one for the 'owner', one for the 'group', and one for the 'world'. A common security mistake is setting these incorrectly.

In this short recipe, you will check your permissions for your 'files' and 'folders'.

Getting ready

You will need:

Your FileZilla FTP client and FTP username and password.

How to do it...

  1. Open your FileZilla FTP client and in your Site Manager select your web host
  2. In the right-hand pane of FileZilla, you will see your files and folders. To the far right (scroll over ) you will see the Permissions and Owner/Group columns as shown in the following screenshot:
    How to do it...

    There are many files and they should be set (as this is a fresh install) ok. However, it won't hurt to check.

  3. Click one of the folders then (for Windows ® users) press Ctrl+A. This will highlight all the files and folders in your site. You should see a screen similar to the following:
    How to do it...

    This partial screenshot shows you have selected everything.

  4. Right-click in the blue colored portion. Select File permissions…:
    How to do it...
  5. FOLDER PERMISSIONS should be set for 755.

    The following items should be checked or filled in:

  6. Numeric value should be set for 755.
  7. Check the box Recurse into subdirectories.
  8. Check the box Apply to directories only.

    Note that if you get it wrong, don't worry - you can repeat it.

    This process will take a few minutes so be patient.

    How to do it...
  9. File Permissions should be set to 644

    Tip

    In some hosting setups you may not be able to perform this step. This would be why you would have needed to turn on the FTP LAYER earlier

  10. Following the same process as in step 4, highlight all your files and folders, right click, and click your file permissions selection.

    This time however you will change the settings as follows:

  11. Numeric value should be set for 644.
  12. Check the box Recurse into subdirectories.
  13. Check the box Apply to files only.
    How to do it...

    This step will take longer than the DIRECTORIES step.

    Once complete you may exit FileZilla.

How it works...

This will establish the 'permission's properly. Linux sets up three different classes for permissions on each file and folder:

User (u): This is the owner of the file

Group (g): Other users who are in a group and able to access files

Other (o): PUBLIC or the WORLD (meaning - everyone who does not belong to the other two roles)

You noted the numbers 755 and 644. These numbers are represented by the OCTAL numbering system (BASE 8). What they tell the Operating System about the files is as follows:

READ is 4

WRITE is 2

EXECUTE is 1

In OCTAL we add them the same as normal numbers. For example, 4+2+1 = 7. Meaning we give the OWNER of the folder READ, WRITE, and EXECUTE permissions.

Whereas we give the GROUP and OTHER 4+1 = 5, READ and WRITE permission.

On our FILES we give the OWNER 4+2 = 6 and for the GROUP and OTHER we give 4 only - giving them permission to READ ONLY.