CSCI 257: Fundamental UNIX System Administration
Class Project for Spring 2003
The goal of the class project is to provide students with practical experience
to administer Linux installation and administration on a computer shared
with Windows.
Laboratory Assignment 3
ASSIGNMENT DUE: 12:00 NOON, February 26, 2003.
Assignment Description:
As a system administrator, you will need to do a number of things. You
will need to manage user and group accounts, be able to monitor and kill
processes running on your system and manage the file system.
Goal:
The goal of this assignment is to introduce students
to managing user accounts on a Linux System, processes and the file system.
Objectives:
- Learn some Linux basics.
- Learn how to create, disable, and delete user accounts.
- Learn the format of /etc/passwd, /etc/shadow
- Learn how to monitor and kill processes
- Learn something about the layout of the file system
- Learn a little about run levels and shutting down a Linux system
Expected Outcome:
- Students will print out this lab, follow the instructions and
fill out answers in the spaces provided.
- TURN-IN
- A printout of this lab with answers and students name at the top.
- Grading
- As long as you complete this assignment and use the references
I provide you should get 100%
- You will loose points if answers are blatantly wrong (I'm not going
to be too nitpicky on most of the answers especially since there is more
than one way to do just about anything).
- You will loose points for anything left blank.
- If something in this assignment doesn't exist on your Linux system
give some sort of an explanation rather than leave anything blank. For
example, "No such file" or "Command doesn't exist" and giving any additional
detail would be good especially since I think most everything should be
okay.
I created this lab using some sections from an Introduction to Linux,
and The Linux Cookbook. Both books are available at no charge
through the Linux Documentation Project. This lab should be pretty
easy because I list what book to use as a reference (even the sections and
chapters) before each set of questions. Although I probably screwed
up and included a question or two associated with a reference whose answer
isn't in that reference (sorry). If that is the case you should still
be able to find the answer somewhere else and it shouldn't cause you too
much difficulty.
Introduction to Linux: A Hands on Guide by Machtelt Garrels
read Sections 3.1, 3.2, 4.1, 4.2, and 4.3 online, http://www.tldp.org/LDP/intro-linux/html/index.html
or download the entire book http://www.tldp.org/LDP/intro-linux/Intro-Linux.html.tar.gz
The Linux Cookbook: Tips and Techniques for Everyday Use by Michael
Stutz
In Part One read Chapter 3 only, http://www.tldp.org/LDP/linuxcookbook/html/cookbook_4.html#SEC18
or download the entire book http://www.tldp.org/LDP/linuxcookbook/linuxcookbook-1.2.html.tar.gz
Note: Use your user account to do these exercises (don't use root
except when you need to).
Generic questions to find out what kind of system you are doing you work
on
- What distribution and version of Linux are you using?__________________________________
- Do you have X configured on this system?____________________________________________
- Do you have internet access on this system under Linux?_________________________________
- What shell are you using (bash is the Linux default, type echo
$SHELL )?__________________
The Linux Cookbook - Chapter 3 "What Every Linux User Knows"
- What command do you use to change user passwords?___________________________________________________
- What would you type to switch to the 3rd virtual console?________________________________________________
- What would you type to scroll back console text?_______________________________________________________
- What command would you use to see who is currently logged in?__________________________________________
- What command would you use to see who you are currently logged in
as?___________________________________
- What command would you use to find out when was the last time a user
was logged in on your system?___________
Introduction to Linux - Chapter 3 "About files and the filesystem"
- Read the man page for the df command
- What does the -h option do?_________________________________________________________
- How many partitions are on your system?______________________________________________
- What is the total size of your Linux installation?_________________________________________
- Type su to become the root user, cd to the root directory
(type cd / ), and type du -hs * to find out the disk usage
for your top-level directories (this will take awhile), and finally type
exit to become a normal user again.
- How much space do the following use:
- bin?_______________________
- boot?______________________
- dev?_______________________
- etc?________________________
- lib?________________________
- sbin?_______________________
- usr?________________________
- tmp?_______________________
- var?________________________
- Read the man page for du, what do the h and s
options do?
- h?____________________________________________________
- s?____________________________________________________
- Change to the /proc directory and type
ls.
- What file contains information about what CPU(s) is the system
running?_____________________
- What file contains information about memory usage on the system?__________________________
- What does the file /proc/version tell you?________________________________________________
- Type cat /proc/pci
- Can you find the name of your video card in the output?________________________________
- Can you find the name of your audio card in the output?________________________________
-
Change to /etc and check out the following
files and tell what they are used for. You can find out by reading
the appropriate chapter of Introduction to Linux (most of the files
are in there), reading the manpage for the file (if it exists), by viewing
the file and reading the comments (if they exist) or by using your textbook
for this class. You will need to be root to view all of these files
(some aren't readable by users). If any of these files don't exist
on your system state "Does not exist".
- motd?_______________________________________________________________________________
- aliases?______________________________________________________________________________
- passwd?______________________________________________________________________________
- If you type man passwd you will get the man page for the
passwd command instead of for the configuration file. Since
there are passwd entries in different sections of the man pages you can
type whatis passwd or man -k passwd to find out what
section the passwd config file is in and then type man [section number]
passwd to get the man page from the appropriate section number (the
same applies with the shadow file).
- shadow?______________________________________________________________________________
- hosts?________________________________________________________________________________
- group?________________________________________________________________________________
- profile?_______________________________________________________________________________
- bashrc?________________________________________________________________________________
- shells?________________________________________________________________________________
- fstab?_________________________________________________________________________________
- mtab?_________________________________________________________________________________
- logrotate.conf?_________________________________________________________________________
-
How many users are defined on your system (type cat /etc/passwd
| wc --lines )?________________________
- What does the command wc do?____________________________________________________________
-
How many groups?___________________________________________________________________________
-
Change to /usr/share/doc (redhat) or /usr/doc (slackware). (There should be a lot
of directories in here containing documentation for different packages on
your system). Look at the fileutils documentation and then
name three programs that come with the GNU fileutils package._______________________________________________________
Unix System Administrators Handbook (the class textbook) - Chapter 6
"Adding New Users"
(You need to be root to add, remove, delete users and groups and in order
to view /etc/shadow).
- Create a new user account on your system
- type useradd -c"A Generic User" joebob
- View /etc/password (type cat /etc/passwd )
- What is joebob's user ID?___________________________
- What is joebob's group ID?__________________________
- What is joebob's default shell?_______________________
- View /etc/group
- Was a new group created?___________________________
- View /etc/shadow (type cat /etc/shadow )
- What is in joebob's password field?______________________________
- Set joebobs password to something using the passwd command.
- View /etc/shadow again, what is in joebob's password field now?_______________________________
- View the output of ls -al /home/joebob and then the output
of ls -al /etc/skel
- Do you notice any similarities between the contents of the two
directories?_______________________
- Remove the new user
- type userdel -r joebob
- What does the -r option do (read the manpage)?____________________________________________
- Does a joebob entry still exist in /etc/passwd?______________________________________________
- If a group entry was created earlier for joebob does it still exist?_______________________________
- What is usermod for (type whatis usermod)?___________________________________________________
- What is the command for adding new groups?___________________________________________________
- What is the command for deleting groups?______________________________________________________
- What are the fields in the /etc/passwd file (read man page for /etc/password
or read your book)?
- 1st?______________________
- 2nd?______________________
- 3rd?______________________
- 4th?______________________
- 5th?______________________
- 6th?______________________
- 7th?______________________
Introduction to Linux - Chapter 4 "Processes"
- For this section run top in one terminal while
you do the exercises in another.
- While top is running you can type 'q' to quit or 'h' for
help
- Answer the following questions while viewing top's output
- How many processes are currently running on your system?________________________________
- How many of those are sleeping?______________________________________________________
- How much memory does top list as free?________________________________________________
- Read the help and find out how you can sort processes by memory
usage, what do you type?_______
- In another terminal run the command find /
- What effect does it have on system load? ___________________________________________
- (You can stop the find command by typing <Ctrl>-c )
- What commands are causing the highest load on your system?__________________________________
_____________________________________________________________________________________
-
Run pstree
- What does pstree give you as output?______________________________________________________
- (If you aren't sure what the output was type 'whatis pstree'
or 'man pstree' to find out what pstree does).
-
Run the ps command.
- View the inittab file on your system ( type 'more /etc/inittab'
)
- What is run level 1?__________________________________
- What is run level 2?__________________________________
- What is run level 3?__________________________________
- What is run level 4?__________________________________
- What is run level 5?__________________________________
- What is run level 6?__________________________________
-
What is the command telinit for? (read the manpage)_________________________________________________
-
What command would you use to change the system runlevel from level
3 to 5?____________________________
-
What command can you use to time the execution of other commands?
(not date)___________________________
-
How long does it take to run ls /etc on your computer? (time
it more than once)____________________________
-
What is the command nice for?___________________________________________________________________
Survey
- How long did this take you?____________________
- Did you learn something new?______________________
- Did it help reenforce anything you already knew?______________________
- Do you think this lab was too easy, too hard, just right?________________________________