Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Setting up a Web Server and File Permissions for CPSC 220 Lab, Lab Reports of Computer Science

The steps to set up a directory for a web server on paprika.umw.edu, including creating a public_html directory, setting permissions, and copying files. It also covers the importance of running the web server as a user with no special privileges and using chmod to alter file permissions.

Typology: Lab Reports

Pre 2010

Uploaded on 08/19/2009

koofers-user-lke
koofers-user-lke 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lab2 - CPSC 220
Part I - setting up files and directories for a Web server
A Web server is software that responds to hypertext transfer protocol (http) requests. On
paprika, the server software is known as httpd, it is a version of Apache (see
http://apache.org), and it is located in the directory /opt/hpws/apache/bin.
The configuration directives for an Apache Web server are set in a file named httpd.conf.
In our case, directives are set so that each user on paprika.umw.edu may make files
accessible via the server on that system. Files that are accessible through the server must
be in a directory named public_html, a subdirectory of a user's home directory.
Log in to paprika.umw.edu, (or another system on the CPSC LAN in Trinkle) and create
a directory named public_html.
Enter mkdir public_html to do that.
When the server software is running, it like each executing process is associated with a
user on the computer system. It is best to run the Web server software as a user with no
special privileges (Why?). Since the server has no special privileges, all the files
accessible to the server have to be accessible, or readable, by anyone on the system.
When you create a file or directory on our computer system, it has a pre-defined set of
permissions. You may have to alter these to make a file accessible by a Web server.
We’ll be using chmod to do that. The permissions on a directory have to be set so that a
directory is readable and so that a user may access the files in a directory. For each
directory we create for use with the server we’ll use either to get the permissions set
chmod a+rx directory_name or chmod 755 directory_name
To set the permissions correctly on public_html enter
chmod a+rx public_html
To set permissions on all the files in public_html enter
chmod –R a+r public_html
You can read more about chmod by looking at the ‘man page.’ To do that enter
man chmod
Question 1: What would you enter to deny write permission to others?
Question 2: Who can change the mode of a file? Include the appropriate quote form the
man page in writing your answer.
Now copy the file /users/ernie/220/index.html.sample to your directory public_html using
cp /users/ernie/220/index.html.sample $HOME/public_html
Change your current working directory to (or more simply, change to) public_html by
entering
cd public_html
pf3

Partial preview of the text

Download Setting up a Web Server and File Permissions for CPSC 220 Lab and more Lab Reports Computer Science in PDF only on Docsity!

Lab2 - CPSC 220 Part I - setting up files and directories for a Web server A Web server is software that responds to hypertext transfer protocol (http) requests. On paprika, the server software is known as httpd, it is a version of Apache (see http://apache.org), and it is located in the directory /opt/hpws/apache/bin. The configuration directives for an Apache Web server are set in a file named httpd.conf. In our case, directives are set so that each user on paprika.umw.edu may make files accessible via the server on that system. Files that are accessible through the server must be in a directory named public_html, a subdirectory of a user's home directory. Log in to paprika.umw.edu, (or another system on the CPSC LAN in Trinkle) and create a directory named public_html. Enter mkdir public_html to do that. When the server software is running, it like each executing process is associated with a user on the computer system. It is best to run the Web server software as a user with no special privileges (Why?). Since the server has no special privileges, all the files accessible to the server have to be accessible, or readable, by anyone on the system. When you create a file or directory on our computer system, it has a pre-defined set of permissions. You may have to alter these to make a file accessible by a Web server. We’ll be using chmod to do that. The permissions on a directory have to be set so that a directory is readable and so that a user may access the files in a directory. For each directory we create for use with the server we’ll use either to get the permissions set chmod a+rx directory_name or chmod 755 directory_name To set the permissions correctly on public_html enter chmod a+rx public_html To set permissions on all the files in public_html enter chmod –R a+r public_html You can read more about chmod by looking at the ‘man page.’ To do that enter man chmod Question 1: What would you enter to deny write permission to others? Question 2: Who can change the mode of a file? Include the appropriate quote form the man page in writing your answer. Now copy the file /users/ernie/220/index.html.sample to your directory public_html using cp /users/ernie/220/index.html.sample $HOME/public_html Change your current working directory to (or more simply, change to) public_html by entering cd public_html

Rename the file index.html by entering mv index.html.sample index.html Set permissions with chmod a+r index.html View the file by starting up mozilla on the workstation, and entering the URL http://paprika.umw.edu/~your_user_name/index.html substitute your user name for your_user_name Modify the file index.html using vi or another editor, so “Your Name” is replaced with your name. Copy the source file and the script file you created for the first lab public_html. If we suppose the name of the source file was largest.cpp, then you can do this by cp ../largest.cpp largest.cpp cp ../typescript typescript Check to see they are in the correct directory by entering pwd this should return public_html ls this displays the files in the directory. There should be three. Set permissions on each with **chmod a+r *** View each with the browser. For example, use the URL http://paprika.umw.edu/~your_user_name/largest.cpp Try Mozilla for a graphical based browser. Click on the desktop, select Internet Services, and then select Mozilla. It may take a while to start; about a minute. It could be worse than that, the browser may not start or start and quit abruptly. It didn’t work well last semester, but we have different equipment installed. Give it a try. If that doesn’t work, then use the text based browser named lynx. To use it enter the following in a terminal window lynx http://paprika.umw.edu/~your_user_name/index.html Now modify index.html so that the string “Source file” is replaced with Source file and the string “Script file” is replaced with Script file Now when you view http://paprika.umw.edu/~your_user_name/index.html you should have hyperlinks to your source and typescript for lab 1.