Michael Dale
Chmod is the *nix way of handling file permissions. Often you will be asked to make sure to chmod a file with permissions such as 755. What does this mean?
Have a look at this table:
Owner |
Group |
Others |
---|
R |
W |
X |
|
R |
W |
X |
|
R |
W |
X |
|
4 |
2 |
1 |
|
4 |
2 |
1 |
|
4 |
2 |
1 |
|
There are three groups. Owner, Group and Others.
Owner is often you, the person who created the file or folder. Group is the users who share the same group as you. Others is everyone else.
Now with file permissions we have 3 options. R (for Read), W (for Write) and X (for eXecute).
Under these options in the table you will see a number. 4 for read, 2 for write and 1 for execute.
Just say we wanted to give permissions to everyone to read, write and execute a file the chmod number would be:
777 ((4 + 2 + 1)(4 + 2 + 1)(4 + 2 + 1))
If we just want the owner to have these permissions it would be:
700 ((4 + 2 + 1)(0 + 0 + 0)(0 + 0 + 0))
For read and write for the owner and read only for everyone else it would be:
644 ((4 + 2 + 0)(4 + 0 + 0)(4 + 0 + 0))
And so on.
To chmod a single file we use the command:
chmod 777 filename
To chmod a folder we use the command:
chmod 777 foldername/
To chmod a folder and all files and folders inside we use:
chmod -R 777 foldername/
To list the files and permissions of a certain folder use:
ls -l
Anyway I hope this maybe useful for someone. Maybe if you have shell access on a *nix machine or something.