The chmod command
When you create your CGI programs, you will need to change the access privileges to that they can be executed from a web page. To do this, you will use the chmod command. The chmod command has 2 properties, who will have privileges, and which privileges will they have.
1. Who will have privileges?
They are represented by the letters u, g, and o. Also the letter 'a' can represent All the categories together.
2. What privileges can people have?
Privileges are assigned with an equals sign (=r, or =rw, or =rx), or added with a plus sign (+r, or +rwx), or subtracted with a minus (-w, or -rwx)
3. How do I type the command? For most CGI programs, I want to give read and execute privileges to the world, but not write, so that no one can delete or edit my program. This is the most common command:
chmod a+rx filename.cgi
This means add the ability to read and execute to everyone. When I first create a file, I have full read, write, execute privileges, but no one else has anything. This command gives the world the ability to run my program.
Try this example. You are still in the myfolder folder.
A lot of information is displayed about practice.txt, including its size, its owner, and date last saved.
The first 3 places indicate the user privileges (read,write,execute). The second three are the group privileges (none) and the third three are the other privileges (none).
To add read and execute privileges to all categories:owner, group, and other.
This time the privileges should read rwxr-xr-x , indicating that the owner still has full privileges, and that group and others have read and execute, but not write.
The privileges now read rwxr--r-- , indicating that the owner still has full privileges, and that group and others have only read privileges.
Remove the myfolder folder
Try this matching game
Here is the answer key: