[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 2

getty Command

Purpose

Sets the characteristics of ports.

Syntax

getty [ -r | -u ] PortName

Description

The getty command sets and manages terminal lines and ports. The getty command is run by the init command. The getty command is linked to the Terminal State Manager program. The Terminal State Manager program provides combined terminal control and login functions.

Note: The getty command is not entered on the command line.

When invoked as the getty command, the Terminal State Manager program provides the normal port management functions that include:

Bidirectional use Allows terminal lines to be used to initiate and accept connections.
Line speed Sets the baud rates for sending and receiving.
Parity Sets the parity to be even, odd or none.
Delays Sets the delays for carriage return, tab, new line, and form feed.
Character set mapping Sets the character set mapping for case, tabs, and carriage control.
Logger Program Specifies the program used to log the user into the system. If the attribute is set, the Secure Attention Key (SAK) processing is disabled. If the attribute is not set, it defaults to /usr/sbin/login. The logger attribute is contained within the Object Data Manager (ODM) database.
Character and line erase Sets the keystroke used for character and line erase.
Echoing mode Sets the echo to local or remote.

When the getty command is invoked, the following steps occur:

  1. The port protection is set according to the owner and protection attributes in the ODM database. If these attributes are not specified, they default to root and 622.
  2. The port specified by the PortName parameter is opened. If the carrier detection is available on the port, the open does not complete until the carrier is present or another process has lost the carrier with the port.
  3. The specified port might be locked. If the getty command is run with the -u or -r flag, it attempts to lock the port. If the port is already locked the command waits until the port is available and then exits. If the -r flag was specified, the getty command waits for a byte of data to be received on the port before continuing.
  4. The terminal attributes are set according to the configuration information for the specified port. Secure Attention Key processing can be enabled at this point depending on the system configuration.
  5. The herald message is written to the specified port.
  6. The login name is read from the specified port. If a framing error or a break occurs, the getty command repeats steps four and five with the next group of configured terminal attributes. This is most commonly used to cycle the baud rates for modems. But any ODM field (except logmodes and runmodes) may be cycled by entering a list of comma separated values in the ODM database.
  7. The terminal modes are reset according to the runmodes parameter and the login name. If the login name is terminated by a new line, the getty command turns on the carriage-return to new line mapping. If all alphabetic characters are in uppercase, the user is prompted to log in using lowercase characters if possible, and mapping from lowercase to uppercase is turned on.
  8. If a program is specified by the logger parameter, it is executed and Secure Attention Key processing is disabled. Otherwise, the Terminal State Manager program performs a standard system login.

    Note: If the Secure Attention Key sequence is typed during a user login, the user is logged into the trusted shell (if the system is configured where that port is trusted and the user is allowed on the trusted path).

Flags

-r Makes the port available for shared (bi-directional) use. If the lock is unsuccessful, the getty command waits until the lock is available and then exits. If the lock is successful, the getty command waits for a byte of data on the port after locking the port.
-u Makes the port available for shared (bi-directional) use. If the lock is unsuccessful, the getty command waits until the lock is available and then exits.

Security

Access Control: This program should be installed as a program in the Trusted Computing Base, executable by any user and setuid to root.

Example

To enable logging onto tty0, add the following line to the /etc/inittab file:

tty0:2:respawn: /usr/sbin/getty /dev/tty0

This command initializes the port /dev/tty0 and sets up the characteristics of the port.

Files

/usr/sbin/getty Contains the getty command.
/etc/locks Contains lock files that prevent multiple uses of communications devices and multiple calls to remote systems.
/usr/sbin/login The login command.
/usr/bin/setmaps The setmaps command.

Related Information

The login command, setgroups command, shell command, su command, telinit or init command, tsm command.

Object Data Manager (ODM) Overview for Programmers in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]