mgettydefs(4)

πŸ“¦
version 1.2.1 Β· 2 versions
  • 1.2.1 Β· debian bookworm, debian trixie, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.2.1 Β· fedora 43, fedora 44
, in debian bookworm, debian trixie, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

mgettydefs β€” the speed + terminal settings that mgetty is obsessed with πŸ’–


🌸 DESCRIPTION 🌸

okay bestie, so the /etc/gettydefs file is literally where all the info lives that mgetty(1) uses to set up the speed and terminal settings for a line. it ALSO tells you what the login prompt should look like. two jobs, no complaints πŸ’…

a lot of UNIX versions ship a getty(1) that reads /etc/gettydefs too. both mgetty and getty want basically the same format in /etc/gettydefs, except that when mgetty is the one reading it, you get extended functionality ✨. and the cute part? standard getty just straight-up ignores those extra functions, so the two of them can share the same file in peace 🫢. but heads up: mgetty can be compiled to use a file different from /etc/gettydefs if your getty gets all dramatic about the extensions. this manual page documents /etc/gettydefs and describes the extended functionality you get when it's used by mgetty(1). this doc says getty(1) everywhere except where mgetty's behaviour is different, iykyk.

every entry in /etc/gettydefs looks like this:

label# initial-flags # final-flags # login-prompt #next-label

and every entry is followed by a blank line, no skipping πŸŽ€

the login prompt field can contain quoted characters that get converted into other values. here are the sequences and what they turn into:

  • \n β€” newline
  • \r β€” carriage return
  • \g β€” beep
  • \b β€” backspace
  • \v β€” vertical tab (VT)
  • \f β€” formfeed
  • \t β€” tab
  • \L β€” portname
  • \C β€” time in ctime(3) format.
  • \N β€” number of users currently logged in
  • \U β€” number of users currently logged in
  • \D β€” date in DD/MM format
  • \T β€” time in hh:mm:ss format
  • \I β€” modem CONNECT attributes
  • \sequence β€” where "sequence" is a valid strtol format, such as: \0nnn (octal), \0xnnn (hex), or \nnn (decimal).
lowkey important: standard getty usually only supports \b, \r and \n. so don't go wild if you're sharing the file πŸ‘€

now the fields themselves, bestie:

🏷️ label

this is the string that getty tries to match against its second argument. it's often the speed, like 1200, that the terminal is supposed to run at, but it does NOT have to be (see below). main character energy, your choice πŸ’…

🚩 initial-flags

these flags are the initial ioctl(2) settings the terminal gets set to if a terminal type is not specified to getty. the flags getty understands are the ones listed in termio(7). mgetty is usually compiled for termios(7) and often has a more complete set than getty does. slay.

normally only the speed flag is required in the initial-flags. getty automatically sets the terminal to raw input mode and handles the other flags for you. if the -s option is used with mgetty(1) the speed setting is ignored. the initial-flag settings stay in effect until getty executes login(1).

🏁 final-flags

these take the same values as the initial-flags and are set right before getty executes login. the speed flag is again required β€” except with mgetty, if the -s flag was supplied. two other commonly specified final-flags are TAB3, so tabs get sent to the terminal as spaces, and HUPCL, so the line is hung up on the final close. iconic behaviour fr.

πŸ’¬ login-prompt

this entire field gets printed as the login-prompt. unlike the above fields where white space (a space, tab or new-line) is ignored, here they ARE included in the login-prompt field. this field is ignored if the -p option has been specified to mgetty(1).

➑️ next-label

this specifies the label to use if the user types a <break> character, or getty detects a reception error. getty searches for the entry with next-label as its label field and sets up the terminal for those settings. usually a series of speeds are linked together like this into a closed set β€” for instance, 2400 linked to 1200, which in turn is linked to 300, which finally is linked to 2400. next-label is ignored with mgetty(1).


there are several additional composite settings available for initial-flags and final-flags. these are supported by mgetty and usually supported by getty too:

  • SANE β€” equivalent to ``stty sane''. (BRKINT, IGNPAR, ISTRIP, ICRNL, IXON, OPOST, CS8, CREAD, ISIG, ICANON, ECHO, ECHOK)
  • ODDP β€” Odd parity (CS7, PARENB, PARODD)
  • PARITY,EVENP β€” even parity (CS7, PARENB)
  • -ODDP,-PARITY,-EVENP β€” no parity (resets PARENB, PARODD, and sets CS8)
  • RAW β€” raw I/O (no canonical processing) (turns off OPOST, ICANON)
  • -RAW,COOKED β€” enable canonical processing (turns on OPOST, ICANON)
  • NL β€” Ignore newlines. (ICRNL, ONLCR)
  • -NL β€” Respect newlines (turns INLCR, IGNCR, ICRNL, ONLCR, OCRNL, ONLRET off)
  • LCASE β€” Ignore case - treat all as lowercase. (IUCLC, OLCUC, XCASE) Is set if mgetty believes login is entirely uppercase.
  • -LCASE β€” Repect case (turns off IUCLC, OLCUC and XCASE)
  • TABS β€” output tabs as tabs
  • -TABS,TAB3 β€” output tabs as spaces
  • EK β€” Sets VERASE to "#" and VKILL to CKILL respectively. (note that while many gettys default VERASE to "#", mgetty defaults VERASE to backspace.)

and now the extra spicy part 🫢 β€” additionally, mgetty (but NOT getty) can set any of the control characters listed in the c_cc termio(termios) structure by using two tokens:

<character name> <value>

Eg:

VERASE ^h

the value can be set as ^<character>'', \nnn'' or ``<character>'' (normal UNIX \ escapes).

peep the termio(7) or termios(7) manual pages for a list of which ``V'' variables can be changed. note that many of these can be changed in the c_cc array, but won't have any effect. πŸ’€


if getty is called without a second argument, the first entry of /etc/gettydefs is used by getty, which makes the first entry of /etc/gettydefs the default entry. it's also used if getty cannot find the specified label. Mgetty uses a default label of ``n'', but this can be changed in the configuration. and if /etc/gettydefs itself is missing? there's one entry built into the command which brings up a terminal at 300 (configuration parameter in mgetty) baud. built-in backup, we love to see it ✨

it is strongly recommended that after making or modifying /etc/gettydefs, you run it through getty with the check option to be sure there are no errors. no cap, just do it πŸ™

πŸ¦‹ EXAMPLES πŸ¦‹

the following two lines show an example of a 300/1200 baud toggle, which is useful for dial-up ports:

1200# B1200 HUPCL # B1200 SANE IXANY TAB3 #login: #300
300# B300 HUPCL # B300 SANE IXANY TAB3 #login: #1200

the following line shows a typical 9600 baud entry for a hard-wired connection (not currently supported for mgetty):

9600# B9600 # B9600 SANE IXANY IXANY ECHOE TAB3 #login: #9600

the following line is a typical smart-modem setup, suitable for mgetty:

19200mg#
    B19200 #
    B19200 SANE VERASE \b VINTR \003 HUPCL #
    \n\D \T \N Users @!login: #19200mg

πŸŽ€ FILES πŸŽ€

  • /etc/gettydefs

πŸ’œ SEE ALSO πŸ’œ

mgetty(8), getty(8), login(1), ioctl(2), termio(7), termios(7).


and that's the whole vibe check, bestie 🌈 this page is from the mgetty_sendfax manual, section 4, and it was written by greenie way back on 4 Dec 93 β€” like, ancient icon behaviour πŸ‘‘ mgettydefs(4) out, mwah πŸ’–