LOGIN(1)
๐ LOGIN(1) โ like, the begin session on the system girlie โจ
okay so this is login, bestie โ it's the whole begin session on the system moment, and yes she's from User Commands and yes she's iconic. sit down, grab a boba, we're getting you logged in ๐
login [-p] [-s shell] [-h host] [-H] [[-f] username|UID]
โจ NAME โจ
login โ begin session on the system. that's it, that's the vibe ๐
๐ธ SYNOPSIS ๐ธ
login [-p] [-s shell] [-h host] [-H] [[-f] username|UID]
๐ฆ DESCRIPTION ๐ฆ
login is the girl you call when you're signing onto a system. no argument? she just prompts for the username, nbd ๐ซถ
then she prompts for a password, where appropriate. echoing is disabled so nobody can see your password โ literally the bare minimum, we love privacy. only a number of password failures are permitted before login exits and the communications link is severed ๐ check LOGIN_RETRIES in the CONFIG FILE ITEMS section for the deets.
if password aging has been enabled for the account, you might get prompted for a new password before proceeding. in that case you gotta hand over the old password and enter the new one before you can keep going. go read passwd(1) for more, she explains it better ๐
the user and group ID get set according to their values in the /etc/passwd file. there's one exception, and it's a big one: if the user ID is zero, then only the primary group ID of the account is set. this should allow the system administrator to login even in case of network problems. main character sysadmin energy, honestly ๐
the environment variable values for $HOME, $USER, $SHELL, $PATH, $LOGNAME, and $MAIL are set according to the appropriate fields in the password entry. $PATH defaults to /usr/local/bin:/bin:/usr/bin for normal users, and to /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin for root, if not otherwise configured.
$TERM will be preserved, if it exists, else it will be initialized to the terminal type on your tty. $COLORTERM and $NO_COLOR also get preserved if they exist ๐จ
other environment variables are preserved if the -p option is given, or if LOGIN_ENV_SAFELIST defined in /etc/login.defs (see below).
the environment variables defined by PAM are always preserved. no cap.
then the user's shell is started โจ if no shell is specified for the user with -s or in /etc/passwd, then /bin/sh is used. if the specified shell contains a space, it is treated as a shell script. if there's no home directory specified in /etc/passwd, then / is used, followed by .hushlogin check as described below.
if the file .hushlogin exists, then a "quiet" login is performed ๐ this disables the checking of mail and the printing of the last login time and message of the day. otherwise, if /var/log/lastlog exists, the last login time is printed, and the current login is recorded.
๐ OPTIONS ๐
-pโ used bygetty(8)to tellloginto preserve the environment. see alsoLOGIN_ENV_SAFELISTconfig file item.-fโ used to skip a login authentication. this is usually thegetty(8)autologin feature doing its thing ๐-hโ used by other servers (such astelnetd(8)) to pass the name of the remote host tologinso it can be placed inutmpandwtmp. only the superuser is allowed to use this option.
โ ๏ธ heads up bestie:-hhas an impact on the PAM service name. the standard service name islogin, but with the-hoption the name isremote. it is necessary to create proper PAM config files (for example,/etc/pam.d/loginand/etc/pam.d/remote).
-Hโ used by other servers (for example,telnetd(8)) to tellloginthat printing the hostname should be suppressed in thelogin:prompt. see alsoLOGIN_PLAIN_PROMPTbelow.-s,--shellshell โ specify a shell, other than the one defined in/etc/passwd, to log in to. pick your fighter ๐-h,--helpโ display help text and exit. (yes she shares a letter with the host one up there, that's just how it is, we don't ask questions ๐ญ)-V,--versionโ display version and exit.
๐ง CONFIG FILE ITEMS ๐ง
login reads the /etc/login.defs configuration file (see login.defs(5)). note that the configuration file could be distributed with another package (usually shadow-utils). the following configuration items are relevant for login:
MOTD_FILE (string)
specifies a ":" delimited list of "message of the day" files and directories to be displayed upon login. if the specified path is a directory then it displays all files with .motd file extension in version-sort order from the directory ๐
the default value is /usr/share/misc/motd:/run/motd:/etc/motd. if the MOTD_FILE item is empty or a quiet login is enabled, then the message of the day is not displayed. note that the same functionality is also provided by the pam_motd(8) PAM module.
the directories in the MOTD_FILE are supported since version 2.36.
๐ note thatlogindoes not implement any filenames overriding behavior likepam_motd(see alsoMOTD_FIRSTONLY), but all content from all files is displayed. it is recommended to keep extra logic in content generators and use/run/motd.drather than rely on overriding behavior hardcoded in system tools.
MOTD_FIRSTONLY (boolean)
forces login to stop displaying content specified by MOTD_FILE after the first accessible item in the list. note that a directory is one item in this case. this option allows login semantics to be configured to be more compatible with pam_motd. the default value is no. ๐ฆ
LOGIN_ENV_SAFELIST (string)
forces login to protect the specified environment variables if -p is not used. the string value is a comma-separated list of variable names. for example: "LANG,LC_MESSAGES,LC_COLLATE". the safelist is ignored for the environment variables HOME, SHELL and USER. ๐ก๏ธ
LOGIN_PLAIN_PROMPT (boolean)
tell login that printing the hostname should be suppressed in the login: prompt. this is an alternative to the -H command line option. the default value is no.
LOGIN_TIMEOUT (number)
maximum time in seconds for login. the default value is 60. โณ
LOGIN_RETRIES (number)
maximum number of login retries in case of a bad password. the default value is 3.
LOGIN_KEEP_USERNAME (boolean)
tell login to only re-prompt for the password if authentication failed, but the username is valid. the default value is no. she remembers you, king ๐
FAIL_DELAY (number)
delay in seconds before being allowed another three tries after a login failure. the default value is 5.
TTYPERM (string)
the terminal permissions. the default value is 0600 or 0620 if tty group is used. see also mesg(1).
TTYGROUP (string)
the login tty will be owned by the TTYGROUP. the default value is tty. if the TTYGROUP does not exist, then the ownership of the terminal is set to the user's primary group.
the TTYGROUP can be either the name of a group or a numeric group identifier. see also mesg(1).
HUSHLOGIN_FILE (string)
if defined, this file can inhibit all the usual chatter during the login sequence ๐คซ if a full pathname (for example, /etc/hushlogins) is specified, then hushed mode will be enabled if the user's name or shell are found in the file. if this global hush login file is empty then the hushed mode will be enabled for all users.
if a full pathname is not specified, then hushed mode will be enabled if the file exists in the user's home directory.
the default is to check /etc/hushlogins and if it does not exist then ~/.hushlogin.
if the HUSHLOGIN_FILE item is empty, then all the checks are disabled.
DEFAULT_HOME (boolean)
indicate if login is allowed if we cannot change directory to the home directory. if set to yes, the user will login in the root (/) directory if it is not possible to change directory to their home. the default value is yes. ๐
LASTLOG_UID_MAX (unsigned number)
highest user ID number for which the lastlog entries should be updated. as higher user IDs are usually tracked by remote user identity and authentication services there is no need to create a huge sparse lastlog file for them. no LASTLOG_UID_MAX option present in the configuration means that there is no user ID limit for writing lastlog entries. the default value is ULONG_MAX.
LOG_UNKFAIL_ENAB (boolean)
enable display of unknown usernames when login failures are recorded. the default value is no.
๐จ note that logging unknown usernames may be a security issue if a user enters their password instead of their login name. like, imagine. protect yourself.
ENV_PATH (string)
if set, it will be used to define the PATH environment variable when a regular user logs in. the default value is /usr/local/bin:/bin:/usr/bin.
ENV_ROOTPATH (string), ENV_SUPATH (string)
if set, it will be used to define the PATH environment variable when the superuser logs in. ENV_ROOTPATH takes precedence. the default value is /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin.
LOGIN_SHELL_FALLBACK (boolean)
if set to yes, login will provide a valid shell from /etc/shells when the shell specified in /etc/passwd is invalid or inaccessible due to administrative errors. this ensures users can still log in โ
however โ and this is the important bit โ it may bypass intended shell restrictions, potentially causing unexpected behavior if the fallback shell differs from the configured one. so like, use with awareness, bestie ๐ซ
๐ FILES ๐
/var/run/utmp, /var/log/wtmp, /var/log/lastlog, /var/spool/mail/*,
/etc/motd, /etc/passwd, /etc/nologin, /etc/pam.d/login,
/etc/pam.d/remote, /etc/hushlogins, $HOME/.hushlogin
โญ CREDENTIALS โญ
login supports configuration via systemd credentials (see https://systemd.io/CREDENTIALS/). login reads the following systemd credentials:
login.noauth(boolean) โ if set, configuresloginto skip login authentication, similarly to the-foption. ๐
๐ BUGS ๐
the undocumented BSD -r option is not supported. this may be required by some rlogind(8) programs. rip, honestly ๐ญ
a recursive login, as used to be possible in the good old days, no longer works; for most purposes su(1) is a satisfactory substitute. indeed, for security reasons, login does a vhangup(2) system call to remove any possible listening processes on the tty. this is to avoid password sniffing ๐ if one uses the command login, then the surrounding shell gets killed by vhangup(2) because it's no longer the true owner of the tty. this can be avoided by using exec login in a top-level shell or xterm.
exec login
๐ AUTHORS ๐
derived from BSD login 5.40 (5/9/89) by Michael Glad <glad@daimi.dk> for HP-UX. ported to Linux 0.12: Peter Orbaek <poe@daimi.aau.dk>. rewritten to a PAM-only version by Karel Zak <kzak@redhat.com>. legends, all of them ๐ซถ
๐ SEE ALSO ๐
mail(1), passwd(1), passwd(5), utmp(5), environ(7), getty(8), init(8), lastlog(8), shutdown(8)
๐ REPORTING BUGS ๐
for bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.
๐ฅ AVAILABILITY ๐ฅ
the login 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/>.
and that's the whole page, bestie ๐ this was util-linux 2.42.4, dated 2026-09-21, and the manual name is LOGIN(1) in case you forgot already ๐ now go log in, you're gonna slay โจ๐
๐ฆ where this page comes from
- arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms