getty -- set terminal type, modes, speed, and line discipline


/etc/getty -c file
/etc/getty [ -A ] [ -f ] [ -hn ] [ -s detect_time ] [ -t timeout ] [ -x level ] line [ speed [ type [ linedisc ]]]
line [ speed [ type [ linedisc ]]]


getty is a program that is invoked by init(M). It is the second process in the series, (init-getty-login-shell), that ultimately connects a user with the UNIX system. getty uses initcond(ADM) to secure the terminal for logins.

Initially getty displays the messages defined in /etc/default/issue and /etc/issue, if any (see issue(F)). If AUTO is not set in the optional sixth field of the gettydefs(F) file, getty then displays the login_prompt field from the gettydefs file for the entry it is using, reads the user's login name and invokes the login(M) command with the user's name as argument. While reading the name, getty attempts to adapt the system to the speed and type of device being used. If a login_program is specified in the sixth field of the gettydefs file, that program is executed instead of login(M).

line is the name of a tty line in /dev to which getty is to attach itself. getty uses this string as the name of a file in the /dev directory.

The available options are:

disables username check. getty normally checks usernames at login time, passing baduser to login(M) if no such user exists. This protects other strings (such as a password mistakenly entered at the login prompt) from being seen in ps(C) output.

-c file
Checks the speed and tty definitions in file (/etc/gettydefs or a similarly structured file) and sends the results to standard output. Unrecognized modes and improperly constructed entries are reported. For correct entries, flag values are printed.

Enable automatic FAX or DATA call selection. If the return code from the dialer is RCE_FAXMODE, getty will invoke the program configured by the FAX entry of /etc/gettyacts to receive the incoming FAX message. Otherwise, getty assumes that the call type is DATA. This allows it to detect protocols such as PPP or other data call types. See gettyacts(F) for more information.

This option is provided for internal use by ct(C).

Disables the keyboard flush delay for reliably connected serial lines. Without this option, getty discards input for a short time (about 1 second) after displaying its prompt. This is to avoid interpreting modem connect noise or a directly connected system's login prompt as a user name. The delay is automatically disabled on console multiscreens.

-s detect_time
Turns on detection of character sequences indicating PPP, FAX and similar transmissions defined in the file /etc/gettyacts (see gettyacts(F) for the format of this file). getty listens for detect_time tenths of seconds after establishing a data connection. If no such transmission is detected, it generates the normal login messages.

-t timeout
Specifies that getty should exit if the open on the line succeeds and there is no response to the login prompt in timeout seconds.

-x level
If level is greater than 0, then log debugging information to syslog. If level is 0, then no debugging is performed.
The following operands are accepted:

Defines the name of the line to which getty will attach itself. The line name will point to an entry in the /dev directory: for example, /dev/tty00.

Defines the entry to use from the /etc/gettydefs file. The entry defines the line speed, the login message, the initial tty setting, and the next speed to try if the user says the speed is inappropriate (by sending a break character). If no speed is supplied, the first entry in /etc/gettydefs is used. If /etc/gettydefs cannot be read, a default speed of 300 baud is used.

Defines the type of terminal connected to the line. The default terminal is none, representing a normal terminal unknown to the system. For terminal type to have any meaning, the virtual terminal handlers must be compiled into the operating system. They are available, but not compiled in the default condition.

Sets the line discipline to use on the line. The hooks for line disciplines are available in the operating system; five are available, numbered LDISC0 - LDISC4. The default is LDISC0.
getty displays the login message before reading the user's name a character at a time. If a null character (or framing error) is received, it is assumed to be the result of the user pressing the <Break> key. This will cause getty to attempt the next speed in the series determined by what it finds in the file /etc/gettydefs.

The user's name is terminated by a new-line or carriage-return character. This is used to define the subsequent treatment of carriage returns (see ioctl(S)).

The user's name is scanned to see if it contains any lowercase alphabetic characters. getty suggests that the user use all lowercase characters. If the user uses uppercase characters, the system is told to map any future uppercase characters into the corresponding lowercase characters.

Finally, login is executed with the user's name as an argument. Additional arguments may be typed after the login name. These are passed to login (or the login_program specified in the gettydefs(F) entry), which will place them in the environment (see login(M)). If AUTO is specified in the optional 6th field of the gettydefs file, no user interaction occurs before the login program is executed. In this case, the value of getty's line argument is passed to the login program as the argument.

A check option is provided. When getty is invoked with the -c option and file, it scans the file as if it were scanning /etc/gettydefs and prints out the results to the standard output. If there are any unrecognized modes or improperly constructed entries, it reports these. If the entries are correct, it displays the values of the various flags. See ioctl to interpret the values. Note that some values are added to the flags automatically.


In order for a line to be used in both directions, there must be an entry for that line in the Devices(F) (/usr/lib/uucp/Devices) file.

If a line is being used in both directions, getty waits to read a character before it outputs the login message, thus preventing two gettys from looping. This functionality is equivalent to the -r option in other UNIX system implementations.

When connecting two machines for direct bidirectional access, be sure to use the bidirectional version of getty on both ends. For SCO OpenServer, this is getty, but other platforms may use uugetty or other names.

If the line is free, uucico, cu, or ct can use it for dialing out. The implementation depends on the fact that uucico, cu, and ct create lock files when devices are used. When the open returns (or when the first character is read when the line is being used in both directions) the status of the lock file indicates whether the line is being used by uucico, cu, ct, or by someone trying to log in. Note that when the line is being used in both directions, several carriage-return characters may be required before the login message is output. Human users should be able to handle this slight inconvenience; when uucico tries to log in, it told to do this using the following login script:

   "" \r\d\r\d\r\d\r in:--in: ...
where the ... is whatever would normally be used for the login sequence. If /etc/gettydefs is unreadable, getty sets the speed of the interface to 300 baud, specifies that raw mode will be used (awaken on every character), that echo will be suppressed, either parity allowed, that new-line characters will be converted to carriage return-line feed, and that tab expansion is performed on the standard output.

If there is a getty on one end of a direct line between two machines, there must be a getty or uugetty on the other end as well. Here is an /etc/inittab entry using uugetty on an intelligent modem or direct line:

   Se2A:234:respawn:/etc/gety -t60 ty2A 19200

Differences between versions

At one time, a separate /usr/lib/uucp/uugetty binary handled logins on bidirectional lines. This functionality was subsumed by getty itself beginning with Open Desktop 2 (1993). For compatibility with existing inittab entries and system administration procedures, the uugetty command name still exists, but it calls /etc/getty with the specified arguments. All the arguments required by uugetty are recognized by getty.

It is not necessary to use the uugetty name to obtain bidirectional behavior. Bidirectional behavior (in other words, participation in the UUCP locking scheme) is controlled by whether the line is mentioned in the Devices(F) file.



See also

ct(C), cu(C), Devices(F), dial(ADM), gettyacts(F), gettydefs(F), init(M), initcond(ADM), inittab(F), ioctl(S), issue(F), login(M), recon(C), tty(C), tty(M), uucico(ADM)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003