CIT054 Index > Assignment: The Filesystem

Assignment: The Filesystem

You will do this assignment on your local Linux system; it is a “discovery exercise.“

  1. In a terminal window, type script filesystem.script to record your results.

  2. Using the fuser command, see what files are in use on the /home filesystem.

  3. If you have the lsof utility on your system, see what files are in use by user root by typing lsof -u root. (I didn’t want you to have to plow through the entire man page, which seems to go on forever.)

  4. Is /dev/null a block device or a character device? Put your answer into the script as a comment. (At the shell prompt, type a # followed by your answer, then press ENTER.) Hint: use ls -l

  5. Is /dev/hda1 a block device or a character device? Put your answer into the script as a comment. (If you do not have /dev/hda1, try /dev/sda1 instead. The device name depends on what kind of hardware you have installed on your system.

  6. Type a command that will show the the major and minor device numbers for /dev/null, /dev/zero, and /dev/random.

    See the appropriate Wikipedia entries for /dev/zero, /dev/null, and /dev/random if you don’t know what they do.
  7. Confirm that the sticky bit is set on /tmp by typing ls -ld /tmp

  8. As yourself, create a file named /tmp/myfile

  9. Create another user on the system (see how to add another user). Make sure you become yourself (exit from superuser status) before continuing.

  10. Become the other user via su other (where other is the name of this other user)

  11. Try renaming /tmp/myfile to /tmp/otherfile

  12. Try to delete file /tmp/myfile

  13. Type exit to become yourself again.

  14. Remove file /tmp/myfile

  15. Type exit to save the filesystem.script file.

When You Finish

Change the name of the filesystem.script file to the form lastname_firstname_filesystem.script and email it to the instructor.

How to Add a User

Become the root user. In this example, the new user’s name is guest.

Add the new user and create a home directory for that user by typing:

useradd -m guest

Give the new user a password by typing:

passwd guest

When you are ready to get rid of the user, type:

userdel -r guest