Você está na página 1de 1

Introduction to UNIX and Linux: Exercise Sheet 7 http://www.doc.ic.ac.uk/~wjk/UnixIntro/Exercise7.

html

Introduction to UNIX:
Exercise Sheet Seven
N.B. Please perform these tasks on your home PC and take extra care when using the
root account. Since your commands will be carried out without the safeguards that
apply to ordinary users, you may do serious damage to the system. If in doubt, please
ask (preferably before pressing !)

1. Use su - to become root.


2. Add a new user of your choosing to the system. Set their password. Check that
they can log in.
3. Add a new user group of your choosing to the system. Place yourself (i.e. your
login, not root), and the user that you have added in the group. Check that you
are both in the new group.
4. Remove the user that you added.
5. Make yourself a cron job that sends you a message (using write) every 10
minutes. Remove this when you start to find it irritating.
6. Discover how to restart the web server httpd (or any other system daemon).
7. tinyhttpd.pl is a mini-web server written in Perl. Switch back to being a
normal user, and make a copy of tinyhttpd.pl in your home directory.
Change the port number on which it operates to a port of your choice (currently
8080, but use a different one that noone else will be using). Create a
public_html directory in your home directory and create a home page file
inside it called "index.html". Now run tinyhttpd.pl in the background and
use telnet (telnet machine port, where machine is the hostname and port
is the port number, and then issue the HTTP command GET / HTTP/1.0
) or a web browser (call up http://machine:port) to test that your home
page file is in fact being served.
8. Switch back to being root. Add a line to /etc/inittab which will ensure that
your mini web-server will respawn itself if it dies. Kill your web server (using
kill) and see if the respawning works (init re-examines the /etc/inittab
file whenever one of its descendant processes dies so you should not have long
to wait for this to take effect). It may be helpful to monitor the system messages
file with tail -f /var/log/messages.
(BACK TO COURSE CONTENTS)

© September 2001 William Knottenbelt (wjk@doc.ic.ac.uk)

1 of 1 10/17/2009 2:20 PM

Você também pode gostar