Cleo, thats a cool script you have for that!
japamor,
The part that gets confusing is how to put the numbers together. It works like this:
Unix type machines allow for three types of users for a file or directory. The "owner", the "group" and "everyone" else. And, they are assigned in that order.
For each file created on the server, there are three options for use. This is called giving the file "permissions":
r = read the file (see the contents of the file)
w = write to the file (make changes)
x = execute the file (in the case of a program)
Now we have three types of users with three types of options.
owner = rwx
group = rwx
everyone = rwx
The server will look at these groups in order and assign the letters(rwx) to each:
(Think in terms of columns when reading this with the + being the divider between the columns)
owner+group+everyone
rwx+rwx+rwx
When a file is created the server will automaticly give the basic "permissions":
rw- + r-- + r--
This means that you(the owner) can read and write the file, but everyone else, can see the contents but cant make changes to the file.
As the unix type operating systems matured, they found that rwx was to confusing, so the assigned numbers to each of the letters:
r =4
w = 2
x = 1
That turns this:
rwx+rwx+rwx
into this:
421+421+421
When you upload a file to the server, the server will give the file basic "permissions" :
rw-+r--+r--
42-+4--+4--
If you dont understand by now, the rest of this wont make any sense.
You have learned so far that there are times that you need to change the "permissons" on files and directories. To do this, you use the unix command called "chmod" with some numbers.
The next obvious question is, "How do I determine what numbers to use".
Remember the numbers we assigned to each of the "permissions"? We simply need to add them together.
Lets use the basic server permissions the server assigns:
For the owner:
rw- or 42-
4 plus 2 plus 0 = 6
For the group:
r-- or 4--
4 plus 0 plus 0 = 4
For everyone:
r-- or 4--
4 plus 0 plus 0 = 4
Putting that all together, the server assigns to the file the basic permissions of: 644
All of the following lines means the same thing:
rw-+r--+r--
42-+4--+4--
644
Lets say that you have a script that requires the permissions changed to 755.
owner = 7
group = 5
everyone= 5
The owner
4 plus 2 plus 1 = 7
The group:
4 plus 0 plus 1 = 5
Everyone:
4 plus 0 plus 1 = 5
rwx+r-x+r-x
421+4-1+4-1
755
Hopefully that didnt totally confuse you. Use that niftly little tool that Cleo has and do some experimenting, you'll get the hang of it pretty quick.
|