7.4 getty and login
The getty program attaches to terminals and displays a login prompt. On most Linux systems, getty is uncomplicated because the system uses it only for logins on virtual terminals. In a process listing, it usually looks something like this (for example, when running on /dev/tty1):
$ ps ao args | grep getty
/sbin/agetty -o -p -- \u --noclear tty1 linux
On many systems, you may not even see a getty process until you access a virtual terminal with something like CTRL-ALT-F1. This example shows agetty, the version that many Linux distributions include by default.
After you enter your login name, getty replaces itself with the login program, which asks for your password. If you enter the correct password, login replaces itself (using exec()) with your shell. Otherwise, you get a “Login incorrect” message. Much of the login program’s real authentication work is handled by PAM (see Section 7.10).
When investigating getty, you may come across a reference to a baud rate such as “38400.” This setting is all but obsolete. Virtual terminals ignore the baud rate; it’s only there for connecting to real serial lines.
You now know what getty and login do, but you’ll probably never need to configure or change them. In fact, you’ll rarely even use them, because most users now log in either through a graphical interface such as gdm or remotely with SSH, neither of which uses getty or login.