Last Modified: Oct. 26, 2010

Creating a Multiuser Linux Distribution(Part IV)

The purpose of this lab is to continue developing your Linux operating system, so that it will give you a logon prompt for user authentication on multiple ttys.

Step One

We need to copy the following files to our file system. The program files must come from the same distribution as you used last semester; i.e. CentOS
bin etc lib
mkdir group libcrypt.so.1
id passwd libnss_files.so.2
login issue libpam.so.0
grep login.defs libpam_misc.so.0
tar pam.conf pam_permit.so
gzip nsswitch.conf  
  profile  
  1. Start with the files in the /bin directory. Copy the six files listed into your bin directory. (some of these files may be in /usr/bin, but put them all in your bin directory.)
  2. Run the ldd command on each of these files, and write down the names of any libraries needed that you don't already have.
    ldd bin/*
  3. Do these names match the libraries in the list above?
  4. Change directory to /mnt or wherever you mounted your filesystem.
  5. Copy the required libraries to your /lib directory.
    Note: One of the libraires, pam_permit.so, is in the directory: /lib/security, but put it in your lib directory.
    Note2:The libnss_files.so.2 is not required by any command, but is required by one of the pam libraries.
  6. There is an important comamnd in /sbin that must be copied:
    cp /sbin/mingetty /mnt/sbin
    What does this program do?

Step Two

We are now ready to tackle the etc directory.
  1. Copy the files listed in the table above to your etc directory making the modifications noted below.
  2. /etc/group - just the first 10 lines of the system /etc/group file will be more than sufficient.
  3. /etc/passwd - just the first line with the "x" removed from the password field, and the home directory should just be (/); although you may want to add a /root directory.
  4. /etc/issue - you can customize this for your version of Linux.
  5. login.defs - copy as is
  6. /etc/nsswitch.conf - copy as is, but the string "files" should be the only string in the second column for each entry.
  7. /etc/profile - include only the two lines that define environment variables in the middle of the file.
  8. /etc/termcap - As is.
  9. The pam.conf file must be created using an editor of your choice. The file must contain the following four lines:
    	OTHER  auth      optional  /lib/pam_permit.so
    	OTHER  account   optional  /lib/pam_permit.so
    	OTHER  password  optional  /lib/pam_permit.so
    	OTHER  session   optional  /lib/pam_permit.so
  10. Edit your inittab file so that it includes the following lines:
    	id:2:initdefault:
    	si::sysinit:/etc/rc.sysinit
    	l0:0:wait:/etc/rc.halt
    	l1:1:wait:/bin/bash
    	l6:6:wait:/etc/rc.reboot
    	1:2345:respawn:/sbin/mingetty tty1
    	2:2345:respawn:/sbin/mingetty tty2
    	3:2345:respawn:/sbin/mingetty tty3
    	4:2345:respawn:/sbin/mingetty tty4
  11. One last touch up step to complete. Log-ins are logged in a file in the var directory. So we need to create a couple directories and an empty file in our var directory.
    mkdir var; cd var; mkdir log run; touch run/utmp

Step Three

Unmount the file system and test your multiuser system
  1. Change your current working directory back to /root
  2. Unmount your new file system
    umount /mnt
  3. You should now be able to boot up to a login screen using your pen drive. Give it a try!
  4. To test your new Linux, log in as root on one virtual terminal and execute the hostname command.
  5. Then switch terminals and log in again and cat your grub.conf file.
  6. Log in to a third terminal and issue the command:
    init 0
    What will happen?

To Turn In

For this lab I want to see a recursive long listing of your file system, and a copy of your /etc/inittab file:
ls -lR /mountpoint > lab6xx; cat /mountpoint/etc/inittab >> lab6xx

Use the scp command to forward this file to your home directory on opus:
scp lab6xx logname@opus.cabrillo.edu:

Grading Rubrik

3 points -
For having all the files from the table on your root file system.
2 points -
For a correctly specified /etc/inittab file