For your CGI program to run, it must be executable by your Internet server. Therefore, you must set the permissions so the server can read or execute your files, which usually means making your CGI programs world executable. Set your file permissions by using the CHMOD commands. The CHMODís permission mask is a three-digit number.
First digit: Defines the permissions for the owner.
Second digit: Defines the permissions for the group.
Third digit: Defines the permissions for everyone else (referred to as public).
Each digit works the same for each group of users: the owner, group, and public. What you set for one digit has no effect on the other two digits. Each digit is made up of the three Read, Write, and Execute permissions. The Read permission value is 4, the Write permission value is 2, and the Execute permission value is 1. These three numbers are added together to get the permissions for a file. If you want a file to only be readable and not writable or executable, set its permission to 4. This works the same for Write and Execute. Executable only files have a permission of 1.
EXAMPLE: If you want a file to have Read and Write permissions, add the Read and Write values together (4+2) and you get 6-the permissions setting for Read and Write. If you want the file to have Read, Write, and Execute permissions, use the value 7 (4+2+1). Do this for each of the three permission groups and you get a valid CHMOD mask. If you want your file to have Read, Write, and Execute permissions (4+2+1) for yourself; Read and Execute (4+1) for your group; and Execute (1) only for everyone else, you would set the file permissions to 751.