Shell Notes

Login Process

When the system boots the init starts the getty processes.Getty processes read the /etc/gettydefs file, and uses the information to setup terminal charastics and the login prompt.

When it detects a request to login, it prompts the user for a username. It then starts up the login process and passes it the username.

The login process reads the /etc/passwd file to see if a password is necessary for that username, if it is it then prompts the user for a password, which it then varifies. If it is correct match, it set some environment variables, and then starts up the shell program that is associated with that username.

The shell,(csh ksh) then reads its configuration file and setup then checks if a password is necessary for that username. If it is, it then prompts the user for a password.


SHELLS AND THEIR INIT FILES

KSH-SOLARIS

Now executing /etc/profile
Executed at login time.
System wide profile.
Should include pathing and basic shell variable values.

The bare minimum path.

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/bin/X11:/usr/ucb:/usr/local/java/java/bin
export PATH
MANPATH=/usr/man:/usr/local/man:/usr/share/man
export MANPATH


Executing ~/.profile
Executed at login time.
User defined pathing and variables.

If the user want to add local pathing, it should be something like the
following:

PATH=$PATH:$HOME/bin:.
export PATH

Note, this shell appears to only execute the start up files on login.
all sub-process shells inherit their path and environment from the
parrent process. (from the /etc/profile and ~/.profile)

CSH-SOLARIS
Now executing /etc/.login
Executed at login time.
System wide profile.
Should include pathing and basic shell variable values.

The bare minimum path.

set path=(/usr/local/bin /usr/bin /bin /usr/local/bin/X11 /usr/ucb /usr/local/java/java/bin)
set manpath=(/usr/man /usr/local/man)


Now executing ~/.cshrc
Executed at login time and when ever a shell is started up or spauned.
User defined pathing and variables.

If the user want to add local pathing, it should be something like the
following:

set path=($path $HOME/bin .)


Now executing ~/.login
Executed at login time.
Users should add any environment variables or recodes the want to exist in their
interactive environment in this file.

an example of one would be as follows:
setenv EDITOR emacs

BSH-SOLARIS

Now executing /etc/profile
Executed at login time.
System wide profile.
Should include pathing and basic shell variable values.

The bare minimum path.

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/bin/X11:/usr/ucb:/usr/local/java/java/bin
export PATH
MANPATH=/usr/man:/usr/local/man:/usr/share/man
export MANPATH


Now executing ~/.bash_profile
Executed at login time.
User defined pathing and variables.

This file checkes for the existance of ~/.bashrc and sources it,
if it exists. (~/.bashrc is where the pathing should be added for
local users stuff.)

Local environmental variables should be added to this files.

Now Executing ~/.bashrc
Executed at login and when new shell is started up.
User defined pathing and variables.

If the user want to add local pathing, it should be something like the
following:

PATH=$PATH:$HOME/bin:.
export PATH

TCSH-SOLARIS
Now executing /etc/.login
Executed at login time.
System wide profile.
Should include pathing and basic shell variable values.

The bare minimum path.

set path=(/usr/local/bin /usr/bin /bin /usr/local/bin/X11 /usr/ucb /usr/local/java/java/bin)
set manpath=(/usr/man /usr/local/man)


Now executing ~/.cshrc
Executed at login time and when ever a shell is started up or spauned.
User defined pathing and variables.

If the user want to add local pathing, it should be something like the
following:

set path=($path $HOME/bin .)


Now executing ~/.login
Executed at login time.
Users should add any environment variables or recodes the want to exist in their
interactive environment in this file.

an example of one would be as follows:
setenv EDITOR emacs

LINUX.CS.SONOMA.EDU

KSH-LINUX

Now executing /etc/profile
Executed at login time.
System wide profile.
Should include pathing and basic shell variable values.

The bare minimum path.

PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/scripts:/usr/local/java/bin
export PATH


Executing ~/.profile
Executed at login time.
User defined pathing and variables.

If the user want to add local pathing, it should be something like the
following:

PATH=$PATH:$HOME/bin:.
export PATH

Note, this shell appears to only execute the start up files on login.
all sub-process shells inherit their path and environment from the
parrent process. (from the /etc/profile and ~/.profile)

CSH-LINUX
Now executing /etc/csh.cshrc
Executed at login time and any time a shell is initialized
System wide file.
Should include pathing.

The bare minimum path.

setenv PATH "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/scripts:/usr/local/java/bin"

Now executing /etc/csh.login
Executed at login only.
System wide file.
Should include basic environment variables and interactive pathing

The bare minimum would be:

setenv MANPATH "/usr/man:/usr/local/man"
setenv EDITOR emacs



Now executing ~/.cshrc
Executed at login time and when ever a shell is started up or spauned.
User defined pathing and variables.

If the user want to add local pathing, it should be something like the
following:

set path=($path $HOME/bin .)

Now executing ~/.login
Executed at login time.
Users should add any environment variables or recodes the want to exist in their
interactive environment in this file.

an example of one would be as follows:
setenv EDITOR emacs

BASH-LINUX
Now executing /etc/profile
Executed at login time.
System wide profile.
Should include pathing and basic shell variable values.

The bare minimum path.

PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/scripts:/usr/local/java/bin
export PATH

Now executing ~/.bash_profile
Executed at login time.
User defined pathing and variables.

This file checkes for the existance of ~/.bashrc and sources it,
if it exists. (~/.bashrc is where the pathing should be added for
local users stuff.)

Local environmental variables should be added to this files.

Now Executing ~/.bashrc
Executed at login and when new shell is started up.
User defined pathing and variables.

If the user want to add local pathing, it should be something like the
following:

PATH=$PATH:$HOME/bin:.
export PATH

TCSH-LINUX
Now executing /etc/csh.cshrc



Now executing /etc/csh.login



Now executing ~/.cshrc
Sourcing SSU standard files
Now executing /usr/local/lib/ssu.cshrc
Now executing /usr/local/lib/ssu.alias
Sourcing users aliases files standard files
Now executing ~/.alias



Now executing ~/.login
Now executing /usr/local/lib/ssu.login




FROM THE MAN PAGES
SHELL=/bin/bash - on ZIPPY.CS.SONOMA.EDU

/etc/profile
The systemwide initialization file, executed for login
shells
~/.bash_profile
The personal initialization file, executed for login
shells
~/.bashrc
The individual per-interactive-shell startup file
~/.inputrc
Individual readline initialization file

SHELL=/bin/csh - on ZIPPY.CS.SONOMA.EDU

/etc/.login.

When the shell executes a shell script that attempts to exe-
cute a non-existent command interpreter, the shell returns
an erroneous diagnostic message that the shell script file
does not exist.

~/.cshrc Read at beginning of execution by each
shell.
~/.login Read by login shells after .cshrc at
login.
~/.logout Read by login shells at logout.
~/.history Saved history for use at next login.
/etc/.login.

When the shell executes a shell script that attempts to exe-
cute a non-existent command interpreter, the shell returns
an erroneous diagnostic message that the shell script file
does not exist.

SHELL=/bin/ksh - ZIPPY.CS.SONOMA.ED

/etc/profile
/etc/suid_profile
$HOME/.profile
/tmp/sh*
/dev/null

SHELL=/bin/tcsh - ZIPPY.CS.SONOMA.EDU

/etc/csh.cshrc Read first by every shell. ConvexOS, Stel-
lix and Intel use /etc/cshrc and NeXTs use
/etc/cshrc.std. A/UX, AMIX, Cray and IRIX
have no equivalent in csh(1), but read this
file in tcsh anyway. Solaris 2.x does not
have it either, but tcsh reads /etc/.cshrc.
(+)

/etc/csh.login Read by login shells after /etc/csh.cshrc.
ConvexOS, Stellix and Intel use /etc/login,
NeXTs use /etc/login.std, Solaris 2.x uses
/etc/.login and A/UX, AMIX, Cray and IRIX
use /etc/cshrc.

~/.tcshrc (+) Read by every shell after /etc/csh.cshrc or
its equivalent.

~/.cshrc Read by every shell, if ~/.tcshrc doesn't
exist, after /etc/csh.cshrc or its
equivalent. This manual uses `~/.tcshrc' to
mean `~/.tcshrc or, if ~/.tcshrc is not
found, ~/.cshrc'.

~/.login Read by login shells after ~/.tcshrc or
~/.history. The shell may be compiled to
read ~/.login before instead of after
~/.tcshrc and ~/.history; see the version
shell variable.

~/.cshdirs (+) Read by login shells after ~/.login if
savedirs is set, but see also dirsfile.

/etc/csh.logout Read by login shells at logout. ConvexOS,
Stellix and Intel use /etc/logout and NeXTs
use /etc/logout.std. A/UX, AMIX, Cray and
IRIX have no equivalent in csh(1), but read
this file in tcsh anyway. Solaris 2.x does
not have it either, but tcsh reads
/etc/.cshrc. (+)

~/.logout Read by login shells at logout after
/etc/csh.logout or its equivalent.


SHELL=/bin/bash - on LINUX.CS.SONOMA.EDU

/etc/profile
The systemwide initialization file, executed for login shells

~/.bash_profile
The personal initialization file, executed for login shells

~/.bashrc
The individual per-interactive-shell startup file

~/.inputrc
Individual readline initialization file

Environment variables:

To look at the environment variable from the command line, use the following
commands for sh, ksh, or bash:

set

the output should look like this



for csh and tcsh use the printenv or setenv commands, the output should look
like this:

When you run a command such as ls -al /bin the shell actually calles an exec command to overlay the command program over the shell. If for example you run the command such as "ps -fej". The shell actually runs the command exec("/bin/ps","ps","-fej","NULL"); This caused the command ps to run over the top of your active shell.

 
    The basic environment is initialized to:

          HOME=your-login-directory
          LOGNAME=your-login-name
          PATH=/usr/bin:
          SHELL=last-field-of-passwd-entry
          MAIL=/var/mail/your-login-name
          TZ=timezone-specification

     For Bourne shell and Korn shell logins, the  shell  executes
     /etc/profile  and $HOME/.profile, if it exists.  For C shell
     logins, the shell executes  /etc/.login,  $HOME/.cshrc,  and
     $HOME/.login.   The  default  /etc/profile  and  /etc/.login
     files check quotas (see  quota(1M)),  print  /etc/motd,  and
     check  for  mail.   None  of the messages are printed if the
     file $HOME/.hushlogin  exists.   The  name  of  the  command
     interpreter  is  set  to - (dash), followed by the last com-
     ponent of the interpreter's path name, for example, -sh.

     If  the  login-shell  field  in  the  password   file   (see
     passwd(4))  is  empty, then the default command interpreter,
     /usr/bin/sh, is used.  If this field is *  (asterisk),  then
     the  named  directory  becomes  the root directory.  At that
     point login is re-executed at the new level, which must have
     its own root structure.

     The environment may be expanded  or  modified  by  supplying
     additional  arguments  to login, either at execution time or
     when login requests your login name.  The arguments may take
     either  the form xxx or xxx=yyy.  Arguments without an equal

SunOS 5.5.1         Last change: 21 Dec 1995                    2



FILES
     $HOME/.cshrc        initial commands for each csh
     $HOME/.hushlogin    suppresses login messages
     $HOME/.login        user's login commands for csh
     $HOME/.profile      user's login commands for sh and ksh
     $HOME/.rhosts       private      list       of       trusted
                         hostname/username combinations
     /etc/.login         system-wide csh login commands
     /etc/logindevperm   login-based device permissions
     /etc/motd           message-of-the-day
     /etc/nologin        message displayed to users attempting to
                         login during machine shutdown
     /etc/passwd         password file
     /etc/profile        system-wide sh and ksh login commands
     /etc/shadow         list of users' encrypted passwords
     /usr/bin/sh         user's default command interpreter
     /var/adm/lastlog    time of last login
     /var/adm/loginlog   record of failed login attempts
     /var/adm/utmp       accounting
     /var/adm/wtmp       accounting
     /var/mail/your-name mailbox for user your-name
     /etc/default/login  Default value can be set for the follow-
                         ing  flags  in  /etc/default/login.  For
                         example:  TIMEZONE=EST5EDT
                         TIMEZONE       Sets the  TZ  environment
                                        variable   of  the  shell
                                        (see environ(5)).
                         HZ             Sets the  HZ  environment
                                        variable of the shell.
                         ULIMIT         Sets the file size  limit
                                        for the login.  Units are
                                        disk blocks.  Default  is
                                        zero (no limit).
                         CONSOLE        If set, root can login on
                                        that  device  only.  This
                                        will not  prevent  execu-
                                        tion  of  remote commands
                                        with rsh(1).  Comment out
                                        this  line to allow login
                                        by root.
                         PASSREQ        Determines    if    login
                                        requires a password.
                         ALTSHELL       Determines    if    login
                                        should   set   the  SHELL
                                        environment variable.
                         PATH           Sets  the  initial  shell
                                        PATH variable.

SunOS 5.5.1         Last change: 21 Dec 1995                    4

login(1)                  User Commands                  login(1)

                         SUPATH         Sets  the  initial  shell
                                        PATH variable for root.
                         TIMEOUT        Sets   the   number    of
                                        seconds  (between  0  and
                                        900) to wait before aban-
                                        doning a login session.
                         UMASK          Sets  the  initial  shell
                                        file  creation mode mask.
                                        See umask(1).
                         SYSLOG         Determines  whether   the
                                        syslog(3) LOG_AUTH facil-
                                        ity should be used to log
                                        all  root logins at level
                                        LOG_NOTICE  and  multiple
                                        failed  login attempts at
                                        LOG_CRIT.
                         SLEEPTIME      If   present   sets   the
                                        number of seconds to wait
                                        before login  failure  is
                                        printed to the screen and
                                        another login attempt  is
                                        allowed.   Default  is  4
                                        seconds;  Minimum  is   0
                                        seconds.   Maximum  is  5
                                        seconds.