Previous Table of Contents Next


Defining Initialization Files

When a user logs in, the login program sets a number of variables, such as HOME, LOGNAME, and TZ. Then a file called the system profile (initialization file) is run to set systemwide defaults such as PATH, message of the day, and umask. Finally, the user profile initialization file (or files) that sets variables specific to the user is run. For example, the user profile can modify the PATH to include applications run by only that user. Each shell has its own initialization file (or files), as shown in Table 7-6.

Table 7-6 Shell User Initialization Files

Shell Initialization File Purpose
C $HOME/.login Defines user's environment at login
$HOME/.cshrc Defines user's environment for all C shells invoked after login shell
Bourne $HOME/.profile Defines user's environment at login
Korn $HOME/.profile Defines user's environment at login
$HOME/ksh-env Defines user's environment at login in the file specified by the ksh-env environment variable

The SunOS 5.x system software provides default user initialization files for each shell in the /etc/skel directory, as shown in Table 7-7.

Table 7-7 Default Home Directory Initialization Files

Shell File Name
C /etc/skel/local.login
C /etc/skel/local.cshrc
Bourne or Korn /etc/skel/local.profile

Here is the default /etc/skel/local.login file:

# @(#)local.login 1.3     93/09/15 SMI
stty -istrip
# setenv TERM `tset -Q -'

#
# if possible, start the windows system. t Give user a chance to bail out
#
if ( `tty' == "/dev/console" ) then

        if ( $TERM == "sun" || $TERM == "AT386" ) then

                if ( ${?OPENWINHOME} == 0 ) then
                        setenv OPENWINHOME /usr/openwin
                endif

                echo ""
                echo -n "Starting OpenWindows in 5 seconds (type Control-C
                to interrupt)"

                sleep 5
                echo ""
                $OPENWINHOME/bin/openwin
                clear           # get rid of annoying cursor rectangle
                logout          # logout after leaving windows system
        endif
endif

Here is the default /etc/skel/local.cshrc file:

# @(#)cshrc 1.11 89/11/29 SMI
umask Ø22
set path=(/bin /usr/bin /usr/ucb /etc .)
if ( $?prompt ) then
        set history=32
endif

Here is the default /etc/skel/local.profile file:

# @(#)local.profile 1.4 93/09/15 SMI
stty istrip
PATH=/usr/bin:/usr/ucb:/etc:.
export PATH
#
# If possible, start the windows system
#
if [ `tty' = "/dev/console" ] ; then
        if [ "$TERM" = "sun" -o "$TERM" = "AT386" ] ; then

                if [ ${OPENWINHOME:-""} = "" ] ; then
                        OPENWINHOME=/usr/openwin
                        export OPENWINHOME
                fi
                echo ""
                echo "Starting OpenWindows in 5 seconds (type Control-C
                to interrupt)"
                sleep 5
                echo ""
               $OPENWINHOME/bin/openwin
                clear           # get rid of annoying cursor rectangle
                exit            # logout after leaving windows system
        fi
fi


Previous Table of Contents Next