Using Environment Variables

Using Environment Variables

Copyright(c) Management Analytics, 1995 - All Rights Reserved

Copyright(c), 1990, 1995 Dr. Frederick B. Cohen - All Rights Reserved

As systems become larger, more standards are needed to keep track of the increasingly complex configuration. As systems evolve, there is also a tendency for large portions of file structures to be moved between physical areas. Less experienced users and administrators have to do enormous amounts of work every time such a move is made, because the embed pathnames too deeply within the system. More experienced experts eliminate this problem by using the environment variables very extensively.

At login, each user normally interprets the `/etc/profile' file. In well controlled systems, a local variant (stored perhaps in `/usr/local/etc/profile') is interpreted at login to create a set of environment variables which are used by programs to locate files. In Sh and Csh, environment variables are directly available, while programs can access these variables through the `getenv' subroutine call. In a system with multiple applications, each application may have many associated environment variables.

There are several advantages to the use of these environment variables. One major advantage is that it can increase performance by eliminating large path searches, thus reducing program startup time and eliminating many potential locations for Trojan horses. Another major advantage is the ability to move applications transparently. If the software is properly implemented, no program changes will be required to change the directory a set of files are stored in. For installation, we simply put the software in the most convenient place and add one line to the system profile to specify where files are to be found.