Note that CGI is an old technology, but it is only a connection method for connecting the Web to server-side scripts, which could use any kinds of programming languages such as Java and Perl. It gives developers great flexibility, but the security is a major concern.
undcemcs02.und.edu .undcemcs02> mkdir ~/public_html undcemcs02> mkdir ~/public_html/cgi-binwhere the symbol
~ is the user’s root in the Unix file system.
chcon .undcemcs02.
Otherwise, your CGI scripts will not work.
undcemcs02> chcon -R -t httpd_sys_script_exec_t \ /home/”USER.ID”/public_html/cgi-binSwap out “USER.ID” with your login name:
undcemcs02> chcon -R -t httpd_sys_script_exec_t \ /home/first.lastname/public_html/cgi-bin(or replace the above two commands by the following two commands:
undcemcs02> chcon -R -t httpd_sys_script_exec_t /home/”USER.ID”/public_html/cgi-bin
undcemcs02> chcon -R -t httpd_sys_script_exec_t /home/first.lastname/public_html/cgi-bin
where the backslash symbol ‘\’ is used to continue the current command to the next line.)
cgi-bin directory.
The cgi-bin directories are set up so that they do not serve plain HTML pages; they just execute a given CGI script.
An example of a CGI Perl script is ~/public_html/cgi-bin/demo/cgi/1.pl.
Check the CGI Programming 101 for how to write CGI scripts.
undcemcs02> chmod 755 ~/../user.id undcemcs02> chmod 755 ~/public_html/ undcemcs02> chmod 755 ~/public_html/* undcemcs02> chmod 755 ~/public_html/cgi-bin/ undcemcs02> chmod 755 ~/public_html/cgi-bin/*where
user.id is your Linux account identifier.
public_html directory.
~user.id/public_html/out/, then you need to open that directory.
For the example of that directory:
undcemcs02> chmod 755 ~/../user.id undcemcs02> chmod 755 ~/public_html/ undcemcs02> chmod 777 ~/public_html/out/†Note that if you write the file to the directory where the CGI script is, this will cause “Internal Server Error,” that is, try NOT to do the following:
undcemcs02> chmod 777 ~/public_html/cgi-bin/
~/public_html/cgi-bin/demo/cgi/1.pl,|
Grandpa, why don’t you have any life insurance? So you can all be really sad when I die. |