CHMOD tutorial

A guide for new adult webmasters

Written by Tom from Tom's Newbie Booster

Wait! Don't run off in terror; don't fall asleep at the back. It's time to deal with the dreaded subject of CHMOD. CHMOD is something that's pretty unavoidable when you're working on the web, and it's actually not that difficult once you learn a few simple tricks. So get some strong coffee - it's time to tackle CHMOD.

What is CHMOD?


CHMOD is to do with files that are kept on your webspace. Remember that every 'webpage' you look at on the web, every image you see, is actually just a file which is stored on someone's webspace. Even if you've uploaded webpages and images before, you might not have encountered CHMOD before.

Every one of these files on the internet also has some special settings which you would never know were there. These settings are called a file's 'permissions'. If you make a webpage and upload it, even if you didn't add these special settings, that webpage will still have them. Every file must have this special setting and it's impossible to create one that doesn't have it.

Per-what?


As clever as computers are, they still need us to tell them exactly what to do. These special settings or 'permissions' are like a sticky label on the file which your webspace will be able to read. This label gives your webspace special notes about the file and how it should be treated.

These labels normally say one of the following to your webspace:

"This is a normal webpage - just show it to the surfers."

"This is a special file that you can add information to."

"This file is a computer program - run it!"

Whenever you create and upload a file (say index.html of your website) it will get a regular label slapped on it automatically which tells the server "This is a normal webpage - just show it to the surfers." This is perfectly fine for 99% of the time but sooner or later you're going to have to change what the label on a file says.

Why we have to CHMOD


The most common time you'll have to alter a file's label like this is if you're installing some kind of web script. Web scripts (computer programs that run from your webspace) normally need to be changed to "This file is a computer program - run it!". If they are not, in most cases, nothing will happen. The webspace needs to be told that this file is special - it shouldn't just be shown to the surfer, it should be 'run' and THEN shown to the surfer. It's amazing that something as simple as changing a file's label can have such a massive difference. This little setting can mean a web script running or not working at all.

NOTE: Most PHP web scripts do not need to be altered. Those files will 'run' without having their settings altered with CHMOD.

Another time when a file will need to be altered is when the webspace needs to store some information. Say you want to put a counter on your website which increases a number by 1 every time some surfer comes to your page. Your webspace can't actually 'remember' things like that - it needs to write them down. (Come to think of it, that's exactly how I feel too...) So it needs to write that number down in a file. This would normally be a very simple .txt file. But unless you altered that counter.txt's label to say "This is a special file that you can add information to." - then the webspace would not be able to modify it.

In a nutshell CHMOD is all about altering a file's label, or 'permissions', so that your webspace can use it as it needs to.

To complicate things further...


See - you knew there was going to be a twist. Unfortunately, computers don't read things the way we do. And as your webspace is just really a computer that's permanently connected to the web, it's no exception. So when I say that the label on a file says: "This is a special file that you can add information to." that's not how it must be set for the web server to read it. Each file's permissions must appear in code form.

"This is a special file that you can add information to."

must be written for the webserver as:

777

"This file is a computer program - run it!"

must be written for the webserver as:

755

When someone says "CHMOD the file to 755", they are actually saying, "Alter the special settings on that file so that your web server knows it can add information to it."

There is no need to look at "This is a normal webpage - just show it to the surfers." because every time you create and upload a file, this is the setting it will have.

How to CHMOD the easy way


We're nearly there! It does sounds complicated I know - but it's actually something pretty straight forward once you get used to it. The actual process of altering a file's label (permissions) is actually something that takes as little as 5 seconds. There are a number of different ways to change a file's permissions but by far the most common way, and the best way to get the job done, is with your trusty FTP software. While there's a number of different pieces of FTP software available, the process does not vary much from one to the next.

Steps to change a file's permissions (to CHMOD it...)


1) Make sure you're connected to the Internet.

2) Start your FTP software.

3) Connect to your webspace.

4) Find your way into the folder where the files are that need CHMOD'ing.

5) On the RIGHT side of the FTP screen (the webspace side) left mouse click on the file that needs altering. This will select the file.

6) Right click on that file and a menu should pop-up.

7) Choose the 'CHMOD' option by left clicking it.

8) You'll now either have to input the number code that we've been talking about, OR have to check a series of boxes.

Here's a tool that should help on that front:

TNB CHMOD Calculator:

http://www.tomsnewbiebooster.com/resources/ch-mod-calculator/index.html

The boxes need to be ticked as follows:

For 777:

* * *
* * *
* * *

For 755:

* * *
*
* * *


OK that and you should be done. I'd recommend checking out some of the links below too - as the offer specific help on a number of issues I've touched on here. Let me know if you have problems at all!

More CHMOD tutorials and guides:

Tutorials - File Permissions

CHMOD with WS FTP
http://www.zachjorgensen.net/za/chmodtutor.html

CHMOD with Cute FTP
http://www.perlservices.net/en/faq/cute_ftp.shtml#SIX

Unix and CH MOD
http://www.analysisandsolutions.com/code/chmod.htm

Happy CHMOD'ing!


TOM ^"^




ICQ 12616560
Email tom@tomsnewbiebooster.com


Enter TOM'S NEWBIE BOOSTER

">Printer Friendly Version