Information Technology Reference
In-Depth Information
Commands in the login initialization file are executed when the user logs in.
All three common shells provide a login initialization file. Commands in the
shell startup file are executed whenever the logged-in user starts a shell. Both
csh and ksh provide this capability. The ENV parameter is used to define the
name of the ksh shell startup initialization file. Only csh provides a file for
automatic execution of commands when a user logs out.
It is important to know the names of the initialization files and their uses, not only for
the Bourne shell, but also the C and Korn shells.
The System Profile
For user accounts that use sh (Bourne shell) or ksh as a login shell, com-
mands in the system profile are executed before the user's login initialization
file. This file is named /etc/profile and, when executed, sets a default ter-
minal type ( TERM ) and then calls umask(1) to set the default file permission
mask to 022. If the user's home directory does not include a file by the name
of .hushlogin, the user's storage quota is displayed using quot(1M) , the mes-
sage of the day (if any) is displayed, and a notification message is displayed if
new email has arrived for the user.
The following listing shows the default contents of /etc/profile for a
Solaris 9 system:
#ident “@(#)profile 1.19 01/03/13 SMI” /* SVr4.0 1.3 */
# The profile that all logins get before using their own .profile.
trap “” 2 3
export LOGNAME PATH
if [ “$TERM” = “” ]
then
if /bin/i386
then
TERM=sun-color
else
TERM=sun
fi
export TERM
fi
# Login and -su shells get /etc/profile services.
# -rsh is given its environment in its .profile.
case “$0” in
-sh | -ksh | -jsh | -bash)
if [ ! -f .hushlogin ]
then
/usr/sbin/quota
# Allow the user to break the Message-Of-The-Day only.
trap “trap '' 2” 2
/bin/cat -s /etc/motd
trap “” 2
Search WWH ::




Custom Search