open and initialize the tty line, read a login name, and invoke login
alternative getty

agetty [options] port [baud_rate] [term]

opens a tty port, prompts for a login name and invokes the /bin/login command. Normally invoked by init

agetty has several non-standard features that are useful for hardwired and for dial-in lines:

  • Adapts the tty settings to parity bits and to erase, kill, end-of-line and uppercase characters when it reads a login name. handles 7-bit characters with even, odd, none or space parity, and 8-bit characters with no parity.
    Special characters : Control-U (kill); DEL and backspace (erase); carriage return and line feed (end of line). See also the --erase-chars and --kill-chars options.
  • Optionally deduces the baud rate from the CONNECT messages
  • Optionally does not hang up when it is given an already opened line (useful for call-back applications).
  • Optionally does not display the contents of /etc/issue or alternate
  • Optionally does not ask for a login name.
  • Optionally invokes a non-standard login program instead of /bin/login.
  • Optionally turns on hardware flow control.
  • Optionally forces the line to be local with no need for carrier detect. does not use /etc/gettydefs or /etc/gettytab


    port A path name relative to /dev .
    If a - is specified, agetty assumes that its standard input is connected to a tty port and that a connection to a remote user has already been established.

    baud_rate,… A comma-separated list of baud rates.
    Each time agetty receives a BREAK character it advances through the list, which is treated as if it were circular.
    should be specified in descending order, so that the null character (Ctrl-@) can also be used for baud-rate switching.
    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'.

    term The value to be used for the TERM environment variable. This overrides whatever init(8) may have set, and is inherited by login and the shell. Default vt100 or linux for a virtual terminal

    --autologin username
    Log the specified user automatically in without asking for a login name and password.
    -f username is added to the /bin/login command line by default.
    The --login-options changes this default behavior and then only \u is replaced by the username and no other option is added to the login command line.
    Don't reset terminal cflags (control modes). See termios(3) for more details.
    If -H fakehost is given, then -r fakehost is added to the /bin/login command line.
    Enable hardware (RTS/CTS) flow control. It is left up to the application to disable software (XON/XOFF) flow protocol where appropriate.
    --host login_host
    Write the login_host into the utmp file.
    (Normally, no login host is given, since agetty is used for local hardwired connections and consoles.
    Useful for identifying terminal concentrators and etc.
    --issue-file issue_file
    Display the contents instead of /etc/issue. allows custom messages on different terminals. The -i will override this
    Do not display issue before writing the login prompt.
    Terminals or communications hardware may become confused when receiving lots of text at the wrong baud rate; dial-up scripts may fail if the login prompt is preceded by too much text.
    Do not print a newline before writing out issue.
    --init-string initstring
    sent to the tty or modem before sending anything else. This may be used to initialize a modem.
    Non-printable characters may be sent by writing their octal code preceded by a backslash (\). For example, to send a linefeed character (ASCII 10, octal 012), write \012.
    Do not clear the screen before prompting for the login name
    --login-program login_program
    instead of /bin/login. allows the use of for example, of a program that asks for a dial-up password or that uses a different password file).
    Control the CLOCAL line flag. The optional argument is auto, always or never. If the mode argument is omitted, then the default is always.
    If mode is not given , the default is auto.

    always forces the line to be a local line with no need for carrier detect.
    useful with a locally attached terminal where the serial line does not set the carrier-detect signal.

    never explicitly clears CLOCAL from the line setting and the carrier-detect signal is expected on the line.

    auto (agetty default) does not modify CLOCAL setting and follows the setting enabled by the kernel.

    extract the baud rate from the CONNECT status message .
    These status messages are of the form: "-junk--speed--junk>-. agetty assumes that the modem emits its status message at the same speed as specified with (the first) baud_rate value on the command line.
    May fail on heavily-loaded systems, enable BREAK processing by enumerating all expected baud rates on the command line.
    Do not prompt for a login name. used in connection with -l to invoke a non-standard login process
    agetty gets no input from the user who logs in and therefore won't be able to figure out parity, character size, and newline processing of the connection.
    defaults to space parity, 7 bit characters, and ASCII CR (13) end-of-line character.
    Beware that the program that agetty starts (usually /bin/login) is run as root.
    --login-options login_options
    passed to the login program. \u is replaced by the login name.
    The default /bin/login command line is "/bin/login -- username".

    read the SECURITY NOTICE below if to use this.

    Wait for any key before dropping to the login prompt.
    Can be combined with --autologin to save memory by lazily spawning shells.
    --chroot directory
    Change root to the specified directory.
    Call vhangup() to do a virtual hangup of the specified terminal.
    Try to keep the existing baud rate. The baud rates from the command line are used when agetty receives a BREAK character.
    --timeout seconds
    Terminate if no user name could be read within timeout . This option should not be used with hardwired lines.
    Assume that the tty is 8-bit clean, hence disable parity detection.
    Turn on support for detecting an uppercase-only terminal.
    detect a login name containing only capitals as indicating an uppercase-only terminal and turn on some upper-to-lower case conversions. Note that this has no support for any Unicode characters.
    Wait for the user or the modem to send a carriage-return or a linefeed character before sending issue and the login prompt.
    useful in connection with the -I
    --nohints Do not print hints about Num, Caps and Scroll Locks.
    --nohostname By default the hostname will be printed.
    --long-hostname By default the hostname is only printed until the first dot
    --erase-chars string additional characters that should be interpreted as a backspace when the user types the login name.
    --kill-chars string additional characters that should be interpreted as a kill ("ignore all previous characters")
    --chdir directory Change directory before the login.
    --delay seconds Sleep seconds before open tty.
    --nice number Run login with this priority.
    --reload running instances reload and update displayed prompts, if the user has not yet commenced logging in.
    Then exit.


    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:
    /sbin/agetty 9600 ttyS1
    For a directly connected terminal without proper carrier-detect wiring (try this if your terminal just sleeps instead of giving you a password: prompt): /sbin/agetty -L 9600 ttyS1 vt100 For an old-style dial-in line with a 9600/2400/1200 baud modem: /sbin/agetty -mt60 ttyS1 9600,2400,1200 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): /sbin/agetty -w -I 'ATE0Q1&D2&C1S0=1\015' 115200 ttyS1


    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 -f ) may contain escape codes to display the system name, date, time etcetera.
    A backslash (\) immediately followed by one of
    4 or 4{interface} IPv4 address of the specified network interface (for example: \4{eth0}).
    If the interface argument is not specified, then select the first fully configured (UP, non-LOCAL- BACK, RUNNING) interface. If not any configured interface is found, fall back to the IP address of the machine's hostname.
    6 or 6{interface} The same as \4 but for IPv6.
    b baudrate of the line.
    d current date.
    e or e{name} The grafic rendition name
    If the name argument is not specified, then insert \033 aka 1B aka escape.
    The names are: black, blue, lightblue, brown, cyan, lightcyan, darkgray, gray, lightgray, green, lightgreen, red, lightred, magenta,lightmagenta, yellow, blink, halfbright, bold, reverse, and , reset . unknown names are ignored.
    s the system name (the name of the operating system). Same uname -s. See also the \S escape code.
    S or S{VARIABLE} VARIABLE data from /etc/os-release. or /usr/lib/os-release. If the VARIABLE argument is not specified, then use PRETTY_NAME from the file or the system name (see \s). This escape code allows to keep /etc/issue distribution and release independent. Note that \S{ANSI_COLOR} is converted to the real terminal escape sequence.
    l name of the current tty line.
    m architecture identifier of the machine. Same as `uname -m'.
    n nodename of the machine, also known as the hostname. Same as `uname -n'.
    NIS domainname of the machine. Same as `hostname -d'.
    the DNS domainname of the machine.
    r release number of the OS. Same as `uname -r'.
    v version of the OS, e.g. the build-date etc.
    t the current time.
    u number of current users logged in.
    U n users
    An example.
     This is \n.\o (\s \m \r) \t
    displays as: This is (Linux i386 1.1.9) 18:29:30


    /var/run/utmp the system status file. /etc/issue printed before the login prompt. /etc/os-release /usr/lib/os-release operating system identification data. /dev/console problem reports (if syslog(3) is not used). /etc/inittab init(8) configuration file for SysV-style init daemon.


    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. DIAGNOSTICS 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.