Advanced Programming in the UNIX® Environment

(lily) #1
ptg10805159

Section 9.2 Te rminal Logins 289


init

login shell

terminal
device driver

user at a
terminal

fd 0, 1, 2

process ID 1

throughgettyandlogin

hard-wired connection

Figure 9.3 Arrangement of processes after everything is set for a terminal login

Our login shell now reads its start-up files (.profilefor the Bourne shell and
Korn shell;.bash_profile,.bash_login,or.profilefor the GNU Bourne-again
shell; and.cshrcand.loginfor the C shell). These start-up files usually change
some of the environment variables and add many other variables to the environment.
For example, most users set their ownPATHand often prompt for the actual terminal
type (TERM). When the start-up files aredone, we finally get the shell’s prompt and can
enter commands.

Mac OS X Terminal Logins


On Mac OS X, the terminal login process follows essentially the same steps as in the
BSD login process, since Mac OS X is based in part on FreeBSD. With Mac OS X,
however,thereare some differences:

•The work ofinitis performed bylaunchd.
•Weare presented with a graphical-based login screen from the start.

Linux Terminal Logins


The Linux login procedure is very similar to the BSD procedure. Indeed, the Linux
logincommand is derived from the 4.3BSDlogincommand. The main difference
between the BSD login procedureand the Linux login procedure is in the way the
terminal configuration is specified.
Some Linux distributions ship with a version of the initprogram that uses
administrative files patterned after System V’sinitfile formats. On these systems,
Free download pdf