AGETTY(8)
โจ AGETTY(8) โ the alternative Linux getty โจ
System Administration ๐ bestie we are SO in the system admin section rn
๐ NAME ๐
agetty โ it's the alternative Linux getty, no cap ๐ซถ
๐ธ SYNOPSIS ๐ธ
agetty [options] port [baud_rate...] [term]
๐ฆ DESCRIPTION ๐ฆ
okay so, storytime: agetty opens a tty port, hits you with a login-name prompt, and then runs the /bin/login command. That's the whole job. It's normally launched by init(8), so likeโฆ you're not usually the one calling it, it just happens to you ๐
Now here's the tea: agetty has a bunch of non-standard features that are genuinely iconic for hardwired lines and dial-in lines:
- It adapts the tty settings to parity bits and to erase, kill, end-of-line and uppercase characters while it's reading a login name. The program can handle 7-bit characters with even, odd, none or space parity, and 8-bit characters with no parity. These special characters are the ones it recognizes: Control-U (kill); DEL and backspace (erase); carriage return and line feed (end of line). Also go peek at the
--erase-charsand--kill-charsoptions, they're relevant ๐ - It can optionally figure out the baud rate from the CONNECT messages that Hayes(tm)-compatible modems spit out. detective behavior fr ๐
- It can optionally not hang up when it's handed an already opened line โ which is super useful for call-back applications.
- It can optionally not display the contents of the
/etc/issuefile. shy era. - It can optionally display alternative issue files or directories instead of
/etc/issueor/etc/issue.d. main character chooses her own entrance, periodt. - It can optionally not ask for a login name at all.
- It can optionally invoke a non-standard login program instead of
/bin/login. rebranding โจ - It can optionally turn on hardware flow control.
- It can optionally force the line to be local, with no need for carrier detect. independent queen ๐
๐จ and listen: this program does not use the/etc/gettydefs(System V) or/etc/gettytab(SunOS 4) files. so don't go looking for them, they are not invited to this party ๐
๐ ARGUMENTS ๐
๐ port
A path name relative to the /dev directory. So like, relative. Remember that.
But plot twist โ if a "-" is specified, agetty assumes that its standard input is already connected to a tty port and that a connection to a remote user has already been established. lazy girlboss move, love that for it ๐ซถ
Under System V, a "-" port argument should be preceded by a "--".
โ ๏ธ yes really, that's not a typo, that's the rule.
๐ baud_rate,...
A comma-separated list of one or more baud rates. Every single time agetty receives a BREAK character it advances through the list, and the list is treated as if it were circular. carousel energy ๐
Baud rates should be specified in descending order, so that the null character (Ctrl-@) can also be used for baud-rate switching. order matters bestie, don't freestyle this one ๐
This argument is optional and unnecessary for virtual terminals. vts don't need it, they're built different ๐
The default for serial terminals is to keep the current baud rate (see --keep-baud) and if that's unsuccessful then it defaults to '9600'.
๐ term
The value to be used for the TERM environment variable. This overrides whatever init(1) may have set, and it's inherited by login and the shell. so it ripples down the whole chain, iconic behavior ๐
The default is 'vt100', or 'linux' for Linux on a virtual terminal, or 'hurd' for GNU Hurd on a virtual terminal.
okay that's the setup, keep scrolling bestie, there's more ๐
โจ OPTIONS โจ
okay bestie, this is the part where agetty shows you every single little switch it has. it's a lot. we're gonna get through it together. ๐ซถ
-8,--8bitsโ tells agetty to assume your tty is 8-bit clean, which means parity detection is off. no parity sleuthing for you.-a,--autologinusername โ logs in the specified user automatically, no username or password questions, no waiting. using this option causes an-f usernameoption and argument to get added to the/bin/logincommand line. head over to--login-optionsif you wanna mess with how this one behaves.
ngl this one has a lil side effect: because on auto-login agetty doesn't read from the line at all, it never gets the chance to optimize the line setting, so --autologin may affect the way getty initializes the serial line. ๐
-c,--noresetโ don't reset terminal cflags (the control modes). seetermios(3)for the whole lore.-E,--remoteโ so usually, when something liketelnetd(8)callslogin(1), it hands over a remote hostname. this option is what lets agetty pass what it's using as a hostname along tologin(1)so it can land inutmp(5). see--host,login(1), andutmp(5).- if you gave
--hostfakehost, then an-hfakehost option and argument get added to the/bin/logincommand line. - if you gave
--nohostname, then an-Hoption gets added to the/bin/logincommand line.
- if you gave
see --login-options.
-f,--issue-filepath โ gives a":"delimited list of files and directories to display instead of/etc/issue(or whatever else would've gone there). all the files and dirs you name get displayed, and missing or empty files are silently ignored (no drama). if the path you gave is a directory, then it displays all files with the.issuefile extension from that directory in version-sort order. this is how you get custom messages popping up on different terminals. heads up:--noissueoverrides this whole thing. ๐--show-issueโ displays the current issue file (or other) right there on the current terminal, then exits. use it to review the current setting โ that's it, it's literally not designed for any other purpose. also note the output may use some default or incomplete information, because proper output depends on the terminal and on the agetty command line.-h,--flow-controlโ turns on hardware (RTS/CTS) flow control. and listen, it's on the application to disable the software (XON/XOFF) flow protocol where appropriate. that part's not agetty's business. โจ-H,--hostfakehost โ writes that specified fakehost into the utmp file. normally there's no login host given at all, because agetty is out here serving local hardwired connections and consoles. but this option? lowkey useful for identifying terminal concentrators and the like. ๐-i,--noissueโ don't display the contents of/etc/issue(or other) before writing the login prompt. why would you want that? because terminals or communications hardware can get confused receiving a ton of text at the wrong baud rate, and dial-up scripts may straight up fail if the login prompt is preceded by too much text. keep it minimal bestie.-I,--init-stringinitstring โ sets an initial string to send to the tty or modem before sending anything else. classic use: initializing a modem. non-printable characters? send them by writing their octal code with a backslash (\) in front. for example, to send a linefeed character (ASCII 10, octal 012), you write\12. iconic. ๐-J,--noclearโ don't clear the screen before prompting for the login name. (by default, the screen is cleared, just so we're clear.)-l,--login-programlogin_program โ invoke the login_program you specify instead of/bin/login. this opens the door to a non-standard login program, which could for example ask for a dial-up password or use a whole different password file. see--login-options.-L,--local-line[=mode]โ controls theCLOCALline flag. the optional mode argument isauto,alwaysornever. if you leave mode out, the default isalways. if you don't give--local-lineat all, the default isauto.alwaysโ forces the line to be a local line with no need for carrier detect. handy when you've got a locally attached terminal where the serial line doesn't set the carrier-detect signal.neverโ explicitly clears theCLOCALflag from the line setting, and now the carrier-detect signal is expected on the line.autoโ the agetty default. it does not modify theCLOCALsetting and just follows whatever the kernel has enabled.
-m,--extract-baudโ tries to extract the baud rate out of the CONNECT status message that Hayes(tm)-compatible modems produce. those status messages come in the form:"<junk><speed><junk>". agetty assumes the modem emits its status message at the same speed as specified with (the first)baud_ratevalue on the command line.
โ ๏ธ real talk: since --extract-baud may fail on heavily-loaded systems, you still should enable BREAK processing by enumerating all the expected baud rates on the command line. don't skip that step.
--list-speedsโ displays the supported baud rates. these get determined at compilation time, so what you see is what got baked in. ๐-n,--skip-loginโ don't prompt the user for a login name. people pair this with the--login-programoption to invoke a non-standard login process like a BBS system. but here's the tea: with--skip-login, agetty gets no input from the user who logs in, so it won't be able to figure out parity, character size, or newline processing for the connection. it defaults to space parity, 7 bit characters, and ASCII CR (13) end-of-line character.
๐ beware: the program that agetty starts (usually /bin/login) is run as root. respect the power.
-N,--nonewlineโ don't print a newline before writing out/etc/issue.-o,--login-optionslogin_options โ options and arguments that get passed tologin(1). wherever you put\u, it gets replaced by the login name. like, for example:
--login-options '-h darkstar -- \u'
see --autologin, --login-program and --remote.
๐จ please read the SECURITY NOTICE below before using this option. i'm serious, it's right there for a reason.
-p,--login-pauseโ wait for any key before dropping to the login prompt. can be combined with--autologinto save memory by lazily spawning shells. lazy girl summer, but for processes. ๐-r,--chrootdirectory โ change root to the specified directory.-R,--hangupโ callsvhangup(2)to do a virtual hangup of the specified terminal. bye bestie ๐-s,--keep-baudโ tries to keep the existing baud rate. the baud rates from the command line get used when agetty receives a BREAK character. and if another baud rate was specified, the original baud rate is also saved to the end of the wanted baud rates list. this is how you return to the original baud rate after unexpected BREAKs. so thoughtful. ๐-t,--timeouttimeout โ terminates if no user name could be read within timeout seconds. ngl, using this option with hardwired terminal lines is not recommended.-U,--detect-caseโ turns on support for detecting an uppercase-only terminal. it detects a login name containing only capitals as indicating an uppercase-only terminal, and then turns on some upper-to-lower case conversions. note that this has no support for any Unicode characters. ๐-w,--wait-crโ waits for the user or the modem to send a carriage-return or a linefeed character before sending the/etc/issuefile (or others) and the login prompt. super useful alongside the--init-stringoption.--nohintsโ don't print hints about Num, Caps and Scroll Locks. (love that for you.)--nohostnameโ by default the hostname gets printed. with this option enabled, no hostname at all will be shown. you can also pull this off with theLOGIN_PLAIN_PROMPToption in the/etc/login.defsconfiguration file (more details below).--long-hostnameโ by default the hostname is only printed up until the first dot. with this option enabled, the fully qualified hostname (found bygethostname(3P)or, if that doesn't find it, bygetaddrinfo(3)) is shown. come through, full government name. ๐--erase-charsstring โ specifies additional characters that should be interpreted as a backspace ("ignore the previous character") when the user types the login name. the default additional 'erase' used to be'#', but since util-linux 2.23 no additional erase characters are enabled by default.--kill-charsstring โ specifies additional characters that should be interpreted as a kill ("ignore all previous characters") when the user types the login name. the default additional 'kill' used to be'@', but since util-linux 2.23 no additional kill characters are enabled by default.--chdirdirectory โ change directory before the login.--delaynumber โ sleep number seconds before opening tty.--nicenumber โ run login with this priority.--reloadโ asks all running agetty instances to reload and update their displayed prompts, but only if the user hasn't commenced logging in yet. after doing so, the command exits. fyi, this feature might be unsupported on systems without Linuxinotify(7). ๐--helpโ display help text and exit.--versionโ display version and exit.
๐ CONFIG FILE ITEMS ๐
agetty reads the /etc/login.defs configuration file (see login.defs(5)). quick heads up: that config file could actually be distributed with another package (usually shadow-utils). here's what matters to agetty:
LOGIN_PLAIN_PROMPT (boolean) โ tells agetty that printing the hostname should be suppressed in the login: prompt. it's an alternative to the --nohostname command line option. the default value is no.
๐ธ EXAMPLE ๐ธ
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 --local-line 9600 ttyS1 vt100
for an old-style dial-in line with a 9600/2400/1200 baud modem:
/sbin/agetty --extract-baud --timeout 60 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 --wait-cr --init-string 'ATE0Q1&D2&C1S0=1\015'
115200 ttyS1
๐จ SECURITY NOTICE ๐จ
okay bestie, listen up, this one's important ๐ฅ If you're out here using --login-program and --login-options, you need to know that a malicious user could try to sneak lognames with embedded options into the mix, and those options then get passed straight to whatever login program you're using. Not cute. agetty does check for a leading - and makes sure the logname gets passed as one single parameter (so embedded spaces won't magically create yet another parameter), but depending on how the login binary parses its command line, that might not be enough. So please, fr fr, check that your login program can't be abused this way. ๐
Some programs use -- to say "hey, everything after this is not an option, stop interpreting." Use that feature if it's available by passing -- before the username gets passed by \u. ๐
๐ธ ISSUE FILES ๐ธ
The default issue file is /etc/issue. If that file exists, agetty also checks for the /etc/issue.d directory. That directory is an optional extension to the default issue file, and the content of the directory gets printed after the /etc/issue content. But if /etc/issue doesn't exist, then the directory is ignored, periodt. All the files with the .issue extension from that directory get printed in version-sort order. The whole point is that you can maintain 3rd-party messages independently from the primary system /etc/issue file. โจ
Since version 2.35, additional locations for the issue file and directory are supported. agetty checks for the files /run/issue and /run/issue.d, and then for /usr/lib/issue and /usr/lib/issue.d. The directory /etc is expected for host-specific configuration, /run is expected for generated content, and /usr/lib is used for static configuration maintained by the distribution. ๐
Note that in versions 2.35 to 2.40, the additional locations were only read if the default /etc/issue file did not exist. However, since version 2.41, the additional locations are always read, regardless of whether /etc/issue exists or not. This change allows for the generation of issue files by default. slay ๐
The default paths may be completely overridden by the --issue-file option. In that case the specified path has to be a file or directory, and all the default issue file and directory locations are ignored. ๐
The issue file feature can be completely disabled by the --noissue option.
And yesss, you can review the current issue file by running agetty --show-issue on the current terminal. ๐ฆ
The issue files may contain certain escape codes to display the system name, date, time et cetera. All escape codes consist of a backslash (\) immediately followed by one of the characters listed below. Let's go through every single one, no skipping โจ
4or4{interface}โ Insert the 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-LOCALBACK,RUNNING) interface. If no configured interface is found, fall back to the IP address of the machine's hostname. ๐6or6{interface}โ The same as\4but for IPv6. ๐aโ Insert the list of "good" IP addresses for all interfaces. It prints the best candidates for remote login IP addresses: global and site addresses; if not available, temporary address with the longest lifetime; if not available, link address. Note that link addresses are printed with the local interface name, but they have to be done with the interface name on the machine where they will be used. ๐Aโ Insert the list of all IP addresses for all interfaces. ๐ซถbโ Insert the baudrate of the current line. โกdโ Insert the current date. ๐eore{name}โ Translate the human-readable name to an escape sequence and insert it (for example:\e{red}Alert text.\e{reset}). If thenameargument is not specified, then insert\033. The currently supported names are:black,blink,blue,bold,brown,cyan,darkgray,gray,green,halfbright,lightblue,lightcyan,lightgray,lightgreen,lightmagenta,lightred,magenta,red,reset,reverse,yellowandwhite. All unknown names are silently ignored. ๐จsโ Insert the system name (the name of the operating system). Same asuname -s. See also the\Sescape code. ๐ปSorS{VARIABLE}โ Insert theVARIABLEdata from/etc/os-release. If this file does not exist then fall back to/usr/lib/os-release. If theVARIABLEargument is not specified, then usePRETTY_NAMEfrom the file or the system name (see\s). This escape code can be used to keep/etc/issuedistribution and release independent. Note that\S{ANSI_COLOR}is converted to the real terminal escape sequence. ๐ท๏ธlโ Insert the name of the current tty line. ๐ฅ๏ธmโ Insert the architecture identifier of the machine. Same asuname -m. ๐๏ธnโ Insert the nodename of the machine, also known as the hostname. Same asuname -n. ๐oโ Insert the NIS domainname of the machine. Same ashostname -d. ๐Oโ Insert the DNS domainname of the machine. ๐rโ Insert the release number of the OS. Same asuname -r. ๐ฆtโ Insert the current time. โฐuโ Insert the number of current users logged in. ๐ฅUโ Insert the string1 useror<n> userswhere<n>is the number of current users logged in. ๐vโ Insert the version of the OS, that is, the build-date and such. ๐๏ธ
An example. On my system, the following /etc/issue file:
This is \n.\o (\s \m \r) \t
displays as:
This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30
๐ FILES ๐
/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 (ifsyslog(3)is not used). ๐จ/etc/inittabโinit(8)configuration file for SysV-style init daemon. โ๏ธ
๐ CREDENTIALS ๐
agetty supports configuration via systemd credentials (see <https://systemd.io/CREDENTIALS/>). agetty reads the following systemd credentials:
agetty.autologin(string) โ If set, configures agetty to automatically log in the specified user without asking for a username or password, similarly to the--autologinoption. โจ
๐ BUGS ๐
okay so here's the tea, some of this is a little cursed:
- The baud-rate detection feature (the
--extract-baudoption) 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--extract-baudoption in combination with a multiple baud rate command-line argument, so that BREAK processing is enabled. ๐ญ - The text in the
/etc/issuefile (or other) and the login prompt are always output with 7-bit characters and space parity. ๐ฅฒ - The baud-rate detection feature (the
--extract-baudoption) requires that the modem emits its status message after raising theDCDline. ๐ก
๐ฉบ 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. no cap ๐
๐ AUTHORS ๐
Werner Fink <werner@suse.de>, Karel Zak <kzak@redhat.com>
The original agetty for serial terminals was written by W.Z. Venema <wietse@wzv.win.tue.nl> and ported to Linux by Peter Orbaek <poe@daimi.aau.dk>. absolute icons, we stan ๐ซถ
๐ REPORTING BUGS ๐
For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>. (So if something's giving broken, go tell them there, bestie โจ)
๐ฆ AVAILABILITY ๐ฆ
The agetty command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. go get it ๐
and that's the whole vibe check, bestie โ this page is rocking util-linux 2.42.2 energy, dated 2026-06-16, and it's the AGETTY(8) manual page, so you know it's official. periodt ๐
โจ๐
๐ฆ where this page comes from
- ubuntu stonking: util-linux 2.42.2-1ubuntu2 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms