old-www/LDP/sag/html/login-via-terminal.html

274 lines
4.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Logins via terminals</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Linux System Administrators Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="Logging In And Out"
HREF="log-in-and-out.html"><LINK
REL="PREVIOUS"
TITLE="Logging In And Out"
HREF="log-in-and-out.html"><LINK
REL="NEXT"
TITLE="Logins via the network"
HREF="login-via-network.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux System Administrators Guide: </TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="log-in-and-out.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 10. Logging In And Out</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="login-via-network.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="LOGIN-VIA-TERMINAL"
></A
>10.1. Logins via terminals</H1
><P
><A
HREF="major-services.html#TERMINAL-LOGINS"
>Section 2.3.2</A
> shows how logins happen via
terminals. First, <B
CLASS="COMMAND"
>init</B
> makes sure there is
a <B
CLASS="COMMAND"
>getty</B
> program for the terminal connection
(or console). <B
CLASS="COMMAND"
>getty</B
> listens at the terminal
and waits for the user to notify that he is ready to login in
(this usually means that the user must type something). When it
notices a user, <B
CLASS="COMMAND"
>getty</B
> outputs a welcome message
(stored in <TT
CLASS="FILENAME"
>/etc/issue</TT
>), and prompts for
the username, and finally runs the <B
CLASS="COMMAND"
>login</B
>
program. <B
CLASS="COMMAND"
>login</B
> gets the username as a
parameter, and prompts the user for the password. If these
match, <B
CLASS="COMMAND"
>login</B
> starts the shell configured
for the user; else it just exits and terminates the process
(perhaps after giving the user another chance at entering the
username and password). <B
CLASS="COMMAND"
>init</B
> notices that
the process terminated, and starts a new <B
CLASS="COMMAND"
>getty</B
>
for the terminal.
</P
><DIV
CLASS="FIGURE"
><A
NAME="TERMINAL-LOGINS-TABLE"
></A
><P
><B
>Figure 10-1. Logins via terminals: the interaction of
<B
CLASS="COMMAND"
>init</B
>,
<B
CLASS="COMMAND"
>getty</B
>, <B
CLASS="COMMAND"
>login</B
>, and the
shell.</B
></P
><P
><IMG
SRC="logins-via-terminals.png"></P
></DIV
><P
> Note that the only new process is the
one created by <B
CLASS="COMMAND"
>init</B
> (using the
<TT
CLASS="FUNCTION"
>fork</TT
> system call); <B
CLASS="COMMAND"
>getty</B
>
and <B
CLASS="COMMAND"
>login</B
> only replace the program running in
the process (using the <TT
CLASS="FUNCTION"
>exec</TT
> system call).
</P
><P
> A separate program, for noticing the user, is needed
for serial lines, since it can be (and traditionally was)
complicated to notice when a terminal becomes active.
<B
CLASS="COMMAND"
>getty</B
> also adapts to the speed and other
settings of the connection, which is important especially for
dial-in connections, where these parameters may change from call
to call. </P
><P
> There are several versions of <B
CLASS="COMMAND"
>getty</B
>
and <B
CLASS="COMMAND"
>init</B
> in use, all with their good and
bad points. It is a good idea to learn about the versions on
your system, and also about the other versions (you could use the
Linux Software Map to search them). If you don't have dial-ins,
you probably don't have to worry about <B
CLASS="COMMAND"
>getty</B
>,
but <B
CLASS="COMMAND"
>init</B
> is still important. </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="log-in-and-out.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="login-via-network.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Logging In And Out</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="log-in-and-out.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Logins via the network</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>