CPSCI 105: Explorations in Computer Science
Lab 18
May 1, 2007
Today you're going to work together in your audit groups.
So before you get comfortable in your usual seat, make sure
that you've followed the seating instructions on the board.
Note: There was entirely too much merriment during Thursday's
lab. So no joking around in your groups today. Your instructor
finds it extremely annoying and will penalize you accordingly.
Preliminary
Log in on warp and stay in your
home directory. Open emacs and
add the following at the end of your .bashrc file:
#
# Added 5-1-2007
#
# find out whether we want to change the umask for this shell
echo -n "Are you planning to work as part of a web audit group? ";
read -n 1 ANSWER;
echo ;
case $ANSWER in
Y | y) umask 002;
echo "Files will be created u=rw(x),g=rw(x),o=r";
echo "Use newgrp to change your primary group.";;
?) echo "No change to umask or primary group.";;
esac;
#
# End of 5-1-2007 additions
#
After you've made the above change and saved your .bashrc
file, you need to get bash to take note of the change. Do this by
issuing the command
source .bashrc
from the command line. Answer y when
you're asked if you plan to work as part of a web audit group.
Collaborating using Unix Groups
This is a list of the topics we'll discuss today.
Groups
- Reading the ls -l directory listing
- For this exercise, we're most interested which
group has permission to access a file
- The Linux User Private Group (UPG) scheme
- Determining what groups you're a member of: groups
- Changing your current primary group: newgrp
- Why do this? Every file in the filesystem can be accessed
by some group. When you create a file, it is
automatically assigned to your current primary group.
You can always change the group associated with the file,
but you might forget, and lock out your group by mistake.
So if you've already joined your group before you start
working, you won't have to worry.
Groups and Files
- Setting the group who can access a file: chgrp
- Setting group permissions on a file: chmod
- Only the file owner can chmod a file!
- chmod: using = vs.
using + or -
Groups and Directories
- Setting group permissions on a directory: chmod
- Setting things so that newly-created files inherit the group membership of the directory: chmod +s
- Setting the “sticky bit” on a directory: chmod +t
- How umask (set in your .bashrc file) works
- The UPG scheme and appropriate settings for umask
- Not all Unix/Linux systems use the
UPG
scheme!
On those systems, you might want to rethink the umask settings.
On warp, we are using
UPG.
Lab Exercises
Individual Work
-
Go to your home directory (cd with no argument)
and set your primary group to the default (newgrp
with no argument).
-
Copy the file /home/public/web-authoring/name.html to
your home directory, naming the copy lastname.html
(using your real last name, of course):
cp /home/public/web-authoring/name.html lastname.html
-
Open the file in emacs and change all occurrences of the string
Your Name to your actual name.
-
Copy this file to your group's audit website directory.
If your group is olive, this directory is
/projects/audit-groups/2007/olive/public_html
so you would issue the command
cp filename /projects/audit-groups/2007/olive/public_html/.
(replacing olive with your group's name; also
note that that's not a period, above—it's a dot).
-
Make your public_html/img directory the working directory.
Then check the list of accessibility audit groups
to see whether your name is first, second, or third in your group. (The groups
were generated uniformly randomly using a computer program, so there's no
meaning attached to the order.) You will now copy some files to the directory
/projects/audit-groups/2007/olive/public_html/img
(again, replacing olive with your group's name).
- If your name is first, copy the files w3c_x10*
- If your name is second, copy the files w3c_css*
- If your name is third, copy the files wcag*
-
Make your group's audit website directory the working directory.
Change the group association of the file whose name is your last name
so that it's associated with your audit group. Check the permissions
on the file and make sure that your group can read and write the
file, and that the file is readable by others.
-
Change to the img subdirectory and check to make sure
that the files you copied are readable by others. Then change
back to your audit group's public_html directory.
-
At this point, there should be three lastname.html files,
one for each person in your group. Use emacs to edit the other
two files to each include a new paragraph stating Your
Name was here! (replacing Your Name
with your actual name, of course).
Group Work
Divide up the following three tasks among yourselves.
You can split them up and work individually, or you
can do them together—it's up to you.
-
Edit the current index.html file as follows:
- Change all occurrences of the word "color" to your
group's color.
- Edit the unordered list on the page to include the
name of each person in the group.
- Edit the unordered list so that the name of each
person in the group is a hyperlink to that person's
lastname.html file.
-
In the style subdirectory, create a file named
temporary.css. It should have a CSS timestamp
in it (use the command C-c t to insert an
automatically updating timestamp), and should define
styles for the following HTML elements:
- make the level-1 heading the color of your group's name
- make the validation links and images invisible (set the
appropriate element to display: none )
-
Connect to your group's audit website using the appropriate
link on the list of Accessibility
Audit Websites. (Your username is audit; I'll tell
you your password in class.) Test all links; make sure the
effect of the stylesheet is visible on each page. Look at
each page in Firefox using the View >
Page Style >
No Style option, and the three images
at the bottom of each page should appear. Make sure that
your XHTML and CSS are valid.
Don't leave the classroom until either Nadine or I have
looked at your audit website to make sure you've done
everything correctly.
[ Return to the CPSCI 105-01 homepage ]
Brian J. Rosmaita <contact me>
This page was last modified Tuesday, 1 May 2007 at 04:41 UTC.