agetty [options] port [baud_rate...] [term]
agetty opens a tty port, prompts for a login name and invokes the /bin/login command. It is normally invoked by init(8).
agetty has several non-standard features that are useful for hardwired and for dial-in lines:
This program does not use the /etc/gettydefs (System V) or /etc/gettytab (SunOS 4) files.
Under System V, a "-" port argument should be preceded by a "--".
Baud rates should be specified in descending order, so that the null character (Ctrl-@) can also be used for baud-rate switching.
This argument is optional and unnecessary for virtual terminals.
The default for serial terminals is keep the current baud rate (see --keep-baud) and if unsuccessful then default to '9600'.
The default is 'vt100', or 'linux' for Linux on a virtual terminal, or 'hurd' for GNU Hurd on a virtual terminal.
The mode 'always' forces the line to be a local line with no need for carrier detect. This can be useful when you have a locally attached terminal where the serial line does not set the carrier-detect signal.
The mode 'never' explicitly clears the CLOCAL flag from the line setting and the carrier-detect signal is expected on the line.
The mode 'auto' (agetty default) does not modify the CLOCAL setting and follows the setting enabled by the kernel.
Since the -m feature may fail on heavily-loaded systems, you still should enable BREAK processing by enumerating all expected baud rates on the command line.
Please read the SECURITY NOTICE below if you want to use this.
This section shows examples for the process field of an entry in the /etc/inittab file. You'll have to prepend appropriate values for the other fields. See inittab(5) for more details.
For a hardwired line or a console tty:
For a directly connected terminal without proper carrier-detect wiring (try this if your terminal just sleeps instead of giving you a password: prompt):
For an old-style dial-in line with a 9600/2400/1200 baud modem:
For a Hayes modem with a fixed 115200 bps interface to the machine (the example init string turns off modem echo and result codes, makes modem/computer DCD track modem/modem DCD, makes a DTR drop cause a disconnection, and turns on auto-answer after 1 ring):
If you use the --login-program and --login-options options, be aware that a malicious user may try to enter lognames with embedded options, which then get passed to the used login program. Agetty does check for a leading "-" and makes sure the logname gets passed as one parameter (so embedded spaces will not create yet another parameter), but depending on how the login binary parses the command line that might not be sufficient. Check that the used login program can not be abused this way.
Some programs use "--" to indicate that the rest of the commandline should not be interpreted as options. Use this feature if available by passing "--" before the username gets passed by \u.
The issue-file (/etc/issue, or the file set with the -f option) may contain certain escape codes to display the system name, date, time etcetera. All escape codes consist of a backslash (\) immediately followed by one of the characters listed below.
An example. On my system, the following /etc/issue file:
This is \n.\o (\s \m \r) \t
This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30
The baud-rate detection feature (the -m option) requires that agetty be scheduled soon enough after completion of a dial-in call (within 30 ms with modems that talk at 2400 baud). For robustness, always use the -m option in combination with a multiple baud rate command-line argument, so that BREAK processing is enabled.
The text in the /etc/issue file (or other) and the login prompt are always output with 7-bit characters and space parity.
The baud-rate detection feature (the -m option) requires that the modem emits its status message after raising the DCD line.
Depending on how the program was configured, all diagnostics are written to the console device or reported via the syslog(3) facility. Error messages are produced if the port argument does not specify a terminal device; if there is no utmp entry for the current process (System V only); and so on.
Werner Fink Karel Zak
The original agetty for serial terminals was written by W.Z. Venema <email@example.com> and ported to Linux by Peter Orbaek <firstname.lastname@example.org>.
The agetty command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.