agetty - Linux


Overview

agetty is a process that runs under the init process and waits for incoming calls on a given tty line. When a call is received, agetty reads the line and prints a login prompt. It then starts a login program, such as login or xdm, to allow the user to log in.

Syntax

agetty [options] <tty-line>

Options/Flags

  • -a — Auto login without prompt.
  • -d — Deadline timeout in seconds.
  • -f — Make login prompt non-interactive.
  • -i — Enable issue file.
  • -l — Config file for login program.
  • -n — Hide hostname from login prompt.
  • -s — Login program.
  • -t — Timeout for login prompt in seconds.
  • -T — Connect to terminal in secure mode.
  • -u — Run login program as specified user.
  • -w — Enable reverse line wrap.
  • -x — Show connection details after login.

Examples

  • Start agetty on tty1 with a 5-second timeout:
agetty -t 5 tty1
  • Start agetty on tty7 and automatically log in as user "user":
agetty -a -u user tty7
  • Start agetty on tty9 and display the login prompt without the hostname:
agetty -n tty9

Common Issues

  • agetty does not start automatically: Ensure that agetty is configured in the /etc/inittab file.
  • agetty does not respond to incoming calls: Verify that the tty line specified in the agetty command is correct and that the modem is connected and functioning properly.
  • agetty prompts for password even when auto login is enabled: Check the permissions of the /etc/passwd file and ensure that the user account is configured for automatic login.

Integration

agetty can be combined with other tools to provide additional functionality:

  • Use agetty with pam to implement authentication and authorization policies.
  • agetty can be used in conjunction with shells, such as bash or zsh, to provide a more interactive login experience.
  • Script agetty to perform specific tasks, such as displaying a custom login message or executing commands before starting the login program.

Related Commands

  • login
  • xdm
  • init
  • getty