4.4 getty and Login

4.4 getty and Login

Section 3.1.1 mentioned getty, a program that attaches to terminals and displays a login prompt. On most Linux systems, getty is uncomplicated because the system only uses it for logins on virtual terminals, with lines in /etc/inittab like this one for /dev/tty1:

1:2345:respawn:/sbin/getty 38400 tty1

In this example, 38400 is the baud rate. Virtual terminals ignore the baud rate; it's only there for backward compatibility with terminals connected to real serial lines. Some getty programs (like the mingetty that Red Hat Linux uses for virtual terminals) don't need the baud rate setting.

You are probably most interested in the name of the file that getty prints as the login greeting: /etc/issue. This is a quick and satisfying way to deface your system without doing any real damage.

After you type your login name, getty replaces itself with the login program, which then asks for your password. If you type the correct password, login replaces itself with your shell. Otherwise, you get a "Login incorrect" message.

You now know what getty and login do, but it's unlikely that you'll ever need to configure or change them, because terminals on serial ports have been largely confined to the dustbin of history. The login program has an excessive number of options and configuration files, but they are mostly useless because they deal with security for network login methods, such as telnet, that are insecure in the first place. You will learn in Chapter 6 that you should not use them.


If you want to send and receive faxes or dial up to your machine through your own modem, you may need to work with mgetty, an advanced getty that can work with fax and voice modems.