This page describes (1) what the chmod command actually does, and (2)
how PC users normally chmod files.
First, the CHMOD command is a UNIX command
for assigning permissions to files and and folders; while you can set file permissions on computers running
Windows it's not done using the CHMOD command. So, to perform the CHMOD command on a local
computer you need to be running some variety of UNIX (Linux, Solaris, etc.). Typically people who
find this page are attempting to set file permissions on files for use on the internet
(most CGI scripts require that the files be properly chmodded or they will not function - eg,.guestbooks, messageboards, etc.). In the vast majority of cases
your web host is running UNIX and you can chmod your files using your FTP client.
More on that in a bit....
Some CHMOD Basics
While the "chmod value" of a file or folder is computed and expressed as a numerical value (eg., "755")
you don't need any particular math nor computer skills to chmod files and folders.
Specifically, when we perform the CHMOD command on a file or folder, we set permissions for
who may....
Read
Write, or
Execute a file
Q. Why, or when, is it neccessary to chmod a file?
A. The two most common reasons for chmodding a file are the following:
You're on some sort of network and want to restrict public access to files that are private, or
As mentioned eariler you have a website with CGI
scripts (interactive features, like a guestbook, forum, etc.) and the files must
be properly chmodded in order for the script to work. If you have a script of this
type and it's not working the cause, often, is that you've not chmodded files/folders properly as detailed in
the script's documentation. The result will be the dreaded "Internal Server Error". Scripts used on the net
are often very fussy about permissions settings (chmod values).
Mathematical Basis
Chmod values for files and folders are expressed numerically (by 3 digits). if you're math-phobic (like me) don't let this scare you. Most of
the people reading this page will not be computing chmod values but will, instead, just be pointing and clicking their way
to new chmod values (per a program's documentation).
Here's a real simple summary of what the numbers mean:
1 = execute
2 = write
4 = read
In a 3 digit chmod value the first digit refers to
the rights of the owner, the second
refers to the rights of the group, and the third refers to the rights of the
"world", or everyone.
SO: if you wanted virtually everyone to be able to read, write, and execute a file the chmod value
would be "7-7-7" - since 1 + 2 + 4 = 7.
The Mechanics of CHMODDING Files
This is a bit of a rehash. We've establised that CHMOD is a UNIX command and you cannot CHMOD a file using Windows.
And, if you're reading this page, it's highly unlikely that you're running a UNIX system on your PC. At any rate, to chmod files
you'll need one of the following:
A system running either UNIX or Linux (see my page regarding Linux - it's a Windows alternative and it's free!).
On UNIX one simply navigates to a directory where a file or folders resides and types something like the following:
chmod 777 foo.file (where "foo.file" is the file that needs to be chmodded to 777). You can chmod an entire folder to one
set of permissions by using the "recursive" argument.
For example, I could chmod a folder and all of it's contents to 777 by typing the following:
chmod -R 777 some_folder (where "some_folder" and all of it's contents need to be chmodded to a value of 777).
A shell account of some type - most likely FTP - with a remote host running UNIX. . There are other types of shell accounts (telnet. ssh, etc.) but, again,
if you had the computing skills to use those sorts of functions you wouldn't be reading this page.
CHMODDING Files Using Your FTP Client
Chmodding files using a Windows FTP client is as simple as pointing and clicking. And I've never seen a Windows client that
did not have, as a function, the ability to perform the chmod command on a remote file. Using an older version of CuteFTP
I have snagged some screenshots and included them below. You may be using a different FTP client program but finding and using this
feature should be fairly simple, regardless of which program/version your're using.
They say a picture is "worth a thousand words". There are two pictures below so, after
considerable analysis, I have arrived at the following conclusion: these pictures are
probably worth about two thousand words - saves a lot of typing.
In these images I have used Cute FTP to log into my account with my webhost. In the first image
I right click on a file and point......and then, after I click, the second image displays the option box in
which idiots like myself simply choose the chmod settings (then hit "ok")! It can't get much easier.