getty Command

Purpose

Sets the characteristics of ports.

Syntax

getty [ [ -r | -u | -U ] [ -d ] [ -H HeraldString ] [ -M motdFile ] [ -N ] ] 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.

You can configure the getty command to create your home directory at your login if you do not have a home directory already. The getty command calls the mkuser.sys command to create the home directory and customize the account. To enable this capability, set the mkhomeatlogin attribute of the usw stanza in the /etc/security/login.cfg file to true.

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:

Item Description
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

Item Description
-d Provides debugging information.
-H HeraldString Specifies an alternate herald message to write on the port to prompt for a login name. The message string must be one word and cannot contain any spaces. This string will take precedence over herald messages defined in the /etc/security/login.cfg file. If no string is specified with this option or in the login.cfg file, the default herald from the message catalog will be used.
-M motdFile Specifies the path to an alternate message of the day file. If not specified, this value is /etc/motd by default.
-N Causes getty to bypass any checking for the process ID in the /etc/utmp file. This allows a process other than the lowest login shell to exec getty.
-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.
-U Same as the -u flag, except getty does not wait for the lock to be available. It makes the port available regardless of the lock.

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

Item Description
/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.
/etc/security/login.cfg Contains port login configurations.
/etc/motd Contains the message of the day displayed after login.
/usr/bin/setmaps The setmaps command.
/etc/utmp Contains information about users logged into the system.