CTS 1106 (Intro to Unix/Linux) Project #5
Setup a Personal Web Site

 

Due: by the start of class on the date shown on the syllabus

I.  Create a Web Page:

Using vi/vim create a web page for yourself called “index.htm”.  YborStudent has been configured to allow all students to setup their own web page that can be viewed from anywhere with a web browser.

To create a web page you must first create a directory to hold the file index.htm, which will be found automatically by the Apache web server.  The directory must be named public_html in your home directory.  The file must be a special HTML document, as shown below in the sample web page.  (You may copy this page if you change the name Hymie Piffl to your name).  Feel free to use vi to create a more complex web site if you know how.  Do not copy one from elsewhere or use a tool such as FrontPage to create one for you.  Do not make a graphic-intense web site!  Remember you have a disk quota of only a few megabytes.

Be sure your web page contains your name.  Also, if you add extra content you must make sure your web page doesn't violate the HCC Acceptable Use Policy:  No commercial web sites, no inflammatory, pornographic, or otherwise unacceptable content may be posted on an HCC web server by any student.  Ask your instructor if you are uncertain that some content will be appropriate.

The web page must be a legal HTML page, with no HTML errors for full credit.

Follow these steps exactly:

  1. Make sure your current working directory is your home directory:  cd
  2. Create the directory to hold the web site (unless you already did previously; use ls to check):  mkdir public_html
  3. Create the web page with vi, using the correct file name:  vi public_html/index.htm
    (A sample web page is shown below.)

II.  Set Permissions on the file and directories:

The default permissions won't allow any one to view your web page.  You will need to add some extra permissions.

Add the minimum extra permissions to your home directory, to the public_html directory, and to your index.htm file, so that your website is viewable using the appropriate URL.  Use what you have learned to decide on the correct permissions to use.  (Make sure you don't take away the permissions needed by your instructor to examine your files!  Remember your instructor is the only member of your primary group.)

Once these steps are completed you should be able to view your web page from anywhere using a URL similar to:  http://YborStudent.hccfl.edu/~ua00/.  (Use your login instead of “ua00”, of course.)  If this doesn't work it is likely you didn't name the file or directory correctly, or have incorrect permissions.  Check the steps above for any typos and re-do the commands if necessary.

Adding unnecessary permissions or removing any of the default permissions will lose you credit.  If you are unsure which permissions are required, please ask!

(Hint:  The web server runs as user “apache”, which means the owner and group permissions on your files and directories don't effect the result.  Once the web server finds your file, it only needs to read it in order to copy it to your web browser.  Please don't forget how files are found, by searching each directory starting at the top, until the file's inode is found.)

III.  Answer the following questions about permissions:

Setting permissions correctly is not intuitive!  To help you understand permissions, review your notes and the assigned readings on permissions and then answer the questions below.  It is often easier to experiment than to figure this out.  You can create a directory with a file in it and remove all permissions from both.  Then try the commands below, adding one permission at a time to see what is needed.

For each of the following commands to succeed, what permissions are required on each of the directories and file shown?  (Consider each command separately.)  The answer to each of the 20 questions will be some combination of “r”, “w”, and “x”, or “none”.  For example, for question 1.a you might answer “rw” (but I hope you won't).  Note it doesn't matter if the current user is the owner, a group member, or someone else, of the file or directory; no matter who it is, they will (or won't) need some combination of permissions to perform the indicated action.

Example:

  1. For the command /usr/bin/vim /home/user/file
    1. what permissions(s) are required for /: x   must search / for home
    2. what permissions(s) are required for /usr/bin: x   must search /usr/bin for vim
    3. what permissions(s) are required for /usr/bin/vim: x   must execute vim
    4. what permissions(s) are required for /home/user/file: rw   must read and write file to edit it

Questions:

  1. For the command /bin/ls /home/user/file
    1. what permissions(s) are required for /:
    2. what permissions(s) are required for /home:
    3. what permissions(s) are required for /home/user:
    4. what permissions(s) are required for /home/user/file:
  2. For the command /bin/cat /home/user/file
    1. what permissions(s) are required for /:
    2. what permissions(s) are required for /home:
    3. what permissions(s) are required for /home/user:
    4. what permissions(s) are required for /home/user/file:
  3. For the command /bin/ls -l /home/user/
    1. what permissions(s) are required for /:
    2. what permissions(s) are required for /home:
    3. what permissions(s) are required for /home/user:
    4. what permissions(s) are required for /home/user/file:
  4. For the command cd /home/user
    1. what permissions(s) are required for /:
    2. what permissions(s) are required for /home:
    3. what permissions(s) are required for /home/user:
    4. what permissions(s) are required for /home/user/file:
  5. For the command /bin/rm /home/user/file
    1. what permissions(s) are required for /:
    2. what permissions(s) are required for /home:
    3. what permissions(s) are required for /home/user:
    4. what permissions(s) are required for /home/user/file:

 


Sample Web Page        

Sample web page
<!DOCTYPE HTML>
<HTML LANG="en">
<HEAD>
    <META CHARSET="UTF-8">
    <TITLE> Web page for Hymie Piffl </TITLE>
</HEAD>
<BODY>
    <H1> Web page for Hymie Piffl </H1>
    <P> This is my web page. </P>
</BODY></HTML>

Hints:

You cannot do anything with a file unless you can locate its inode.  Inodes are found by searching directories, starting at “/”.  Search permission on a directory shows as an “x”, which is the same letter as for execute permission on regular files.  Directories are searched to find the inodes of files and subdirectories within.

The permissions required on a file to run some command depend only on what action that command does to the file: If the data in a file is accessed, the command requires read permission.  If the data in a file is modified, write permission is needed.  Files only need execute permission if they are to be executed; in other words, only if they are programs to be run.  So to determine the permissions needed on a file requires you to understand what the command is going to do to the file.

Changing the name of a file, deleting a file, or adding a file, all require changes to the containing directory.  So such actions require write permission on the containing directory.  However, Unix and Linux systems do not consider such changes as a modification to the file you are renaming or deleting, so you do not need write permission on the file in question.  Just the directory that contains the file.

To be turned in:

Email the URL of your web site, and the answers to the above questions, to .  If possible use the “text” and not the “HTML” mode of your email program.  Please use the subject similar to “Intro to Unix/Linux Project #5 (Web Site) Submission”, so I can tell which emails are submitted projects.

Projects will not be returned.  Please do not send as attachments.  Do not send to wpollock@YborStudent.hccfl.edu.  Refer to the Projects and the Submitting Assignments sections of your syllabus for more information.

Confused?  Send questions about the assignment to .  Please use a subject similar to “Intro to Unix/Linux Project #5 (Web Site) Question” so I can tell which emails are questions about the assignment (and not submissions).