Chapter 1: UNIX Basics
Test Your Thinking


You are setting up some training files for new employees. The original files will be stored in a single location (/docs/training with the subdirectories tutorials/ and examples/. Beyond this, invent what you need to.

Since this is an important project, the system administrator will create new groups for you if necessary or modify the system startup files so certain environment variables are set for all new employees.

  1. How are you going to make those files available to the new employees? Since you don’t want to have to replace those files on a regular basis, each employee will get a copy of the files. Outline a plan for this, including:
    1. What permissions will be on the original files? (You are allowed to create new groups for this, if you need to. Try not to create too many.)
    2. How many of the files will employees need to copy? Will they need to copy the subdirectories too?

    Solution:

    The original files need to be copied from /docs/training to some new location. You could give every user a directory under /docs/training or you could have them work in their home directories; I’ve seen both done.

    In this case, I would suggest having employees copy the directories training and examples to their home directories. This means that the files will be easily available when a user logs in. A command such as

    cp -R /docs/training/tutorials /docs/training/examples ~

    will copy both directories into the user’s home directory.

    This has the advantage of being simpler for the users. With one command, all of their files are in place. (If you had a system where there wasn’t a lot of disk space to hold home directories, this would be a bad choice.)

    Since the permissions on a copied file or directory depend upon the user’s umask, the only requirement on the original files is that they be readable by everyone (mode 444).

  2. How are the employees going to actually copy the files? Will they read them into vi and save them under new names? Will they use the cp command? Can you make it easier for them? What command(s) would you suggest they use?

    Possible Solutions:

    1. You could ask users to read each file into vi and save a copy in their home directories. This is awkward and involves a lot of steps that could go wrong.

    2. You could have the name of the directory installed as an environment variable (perhaps TUT) so the command is simpler:

      cp -R $TUT/tutorials $TUT/examples ~

    3. You could have someone write a new command that copies the directories and instruct users to run that command.

      The third option seems the easiest for new users (the ones who most need a tutorial).


    © 1999-2000 by Prentice-Hall, Inc.
    A Pearson Company
    Distance Learning at Prentice Hall
    Legal Notice