{
    "content": [
        {
            "type": "text",
            "text": "# LOGIN (man)\n\n## NAME\n\nlogin - begin session on the system\n\n## SYNOPSIS\n\nlogin [-p] [-h host] [username] [ENV=VAR...]\nlogin [-p] [-h host] -f username\nlogin [-p] -r host\n\n## DESCRIPTION\n\nThe login program is used to establish a new session with the system. It is normally invoked\nautomatically by responding to the login: prompt on the user's terminal.  login may be\nspecial to the shell and may not be invoked as a sub-process. When called from a shell, login\nshould be executed as exec login which will cause the user to exit from the current shell\n(and thus will prevent the new logged in user to return to the session of the caller).\nAttempting to execute login from any shell but the login shell will produce an error message.\n\n## TLDR\n\n> Initiates a session for a user.\n\n- Log in as a user:\n  `login {{user}}`\n- Log in as user without authentication if user is preauthenticated:\n  `login -f {{user}}`\n- Log in as user and preserve environment:\n  `login -p {{user}}`\n- Log in as a user on a remote host:\n  `login -h {{host}} {{user}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (4 subsections)\n- **CAVEATS**\n- **CONFIGURATION** (16 subsections)\n- **FILES**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "LOGIN",
        "section": "",
        "mode": "man",
        "summary": "login - begin session on the system",
        "synopsis": "login [-p] [-h host] [username] [ENV=VAR...]\nlogin [-p] [-h host] -f username\nlogin [-p] -r host",
        "tldr_summary": "Initiates a session for a user.",
        "tldr_examples": [
            {
                "description": "Log in as a user",
                "command": "login {{user}}"
            },
            {
                "description": "Log in as user without authentication if user is preauthenticated",
                "command": "login -f {{user}}"
            },
            {
                "description": "Log in as user and preserve environment",
                "command": "login -p {{user}}"
            },
            {
                "description": "Log in as a user on a remote host",
                "command": "login -h {{host}} {{user}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-f",
                "long": null,
                "arg": null,
                "description": "Do not perform authentication, user is preauthenticated. Note: In that case, username is mandatory."
            },
            {
                "flag": "-h",
                "long": null,
                "arg": null,
                "description": "Name of the remote host for this login."
            },
            {
                "flag": "-p",
                "long": null,
                "arg": null,
                "description": "Preserve environment."
            },
            {
                "flag": "-r",
                "long": null,
                "arg": null,
                "description": "Perform autologin protocol for rlogin. The -r, -h and -f options are only used when login is invoked by root."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "mail",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/mail/1/json"
            },
            {
                "name": "passwd",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/passwd/1/json"
            },
            {
                "name": "sh",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/sh/1/json"
            },
            {
                "name": "su",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/su/1/json"
            },
            {
                "name": "login.defs",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/login.defs/5/json"
            },
            {
                "name": "nologin",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/nologin/5/json"
            },
            {
                "name": "passwd",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/passwd/5/json"
            },
            {
                "name": "securetty",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/securetty/5/json"
            },
            {
                "name": "getty",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/getty/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 35,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-f",
                        "lines": 4,
                        "flag": "-f"
                    },
                    {
                        "name": "-h",
                        "lines": 2,
                        "flag": "-h"
                    },
                    {
                        "name": "-p",
                        "lines": 2,
                        "flag": "-p"
                    },
                    {
                        "name": "-r",
                        "lines": 4,
                        "flag": "-r"
                    }
                ]
            },
            {
                "name": "CAVEATS",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "CONFIGURATION",
                "lines": 2,
                "subsections": [
                    {
                        "name": "CONSOLE___GROUPS (string)",
                        "lines": 6
                    },
                    {
                        "name": "DEFAULT___HOME (boolean)",
                        "lines": 5
                    },
                    {
                        "name": "ENV___PATH (string)",
                        "lines": 4
                    },
                    {
                        "name": "ENV___SUPATH (string)",
                        "lines": 4
                    },
                    {
                        "name": "ERASECHAR (number)",
                        "lines": 4
                    },
                    {
                        "name": "FAIL___DELAY (number)",
                        "lines": 2
                    },
                    {
                        "name": "FAKE___SHELL (string)",
                        "lines": 3
                    },
                    {
                        "name": "HUSHLOGIN___FILE (string)",
                        "lines": 5
                    },
                    {
                        "name": "KILLCHAR (number)",
                        "lines": 4
                    },
                    {
                        "name": "LOGIN___RETRIES (number)",
                        "lines": 6
                    },
                    {
                        "name": "LOGIN___TIMEOUT (number)",
                        "lines": 2
                    },
                    {
                        "name": "LOG___OK___LOGINS (boolean)",
                        "lines": 2
                    },
                    {
                        "name": "LOG___UNKFAIL___ENAB (boolean)",
                        "lines": 5
                    },
                    {
                        "name": "TTYGROUP (string), TTYPERM (string)",
                        "lines": 12
                    },
                    {
                        "name": "TTYTYPE___FILE (string)",
                        "lines": 3
                    },
                    {
                        "name": "USERGROUPS___ENAB (boolean)",
                        "lines": 3
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "login - begin session on the system\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "login [-p] [-h host] [username] [ENV=VAR...]\n\nlogin [-p] [-h host] -f username\n\nlogin [-p] -r host\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The login program is used to establish a new session with the system. It is normally invoked\nautomatically by responding to the login: prompt on the user's terminal.  login may be\nspecial to the shell and may not be invoked as a sub-process. When called from a shell, login\nshould be executed as exec login which will cause the user to exit from the current shell\n(and thus will prevent the new logged in user to return to the session of the caller).\nAttempting to execute login from any shell but the login shell will produce an error message.\n\nThe user is then prompted for a password, where appropriate. Echoing is disabled to prevent\nrevealing the password. Only a small number of password failures are permitted before login\nexits and the communications link is severed.\n\nIf password aging has been enabled for your account, you may be prompted for a new password\nbefore proceeding. You will be forced to provide your old password and the new password\nbefore continuing. Please refer to passwd(1) for more information.\n\nYour user and group ID will be set according to their values in the /etc/passwd file. The\nvalue for $HOME, $SHELL, $PATH, $LOGNAME, and $MAIL are set according to the appropriate\nfields in the password entry. Ulimit, umask and nice values may also be set according to\nentries in the GECOS field.\n\nOn some installations, the environmental variable $TERM will be initialized to the terminal\ntype on your tty line, as specified in /etc/ttytype.\n\nAn initialization script for your command interpreter may also be executed. Please see the\nappropriate manual section for more information on this function.\n\nA subsystem login is indicated by the presence of a \"*\" as the first character of the login\nshell. The given home directory will be used as the root of a new file system which the user\nis actually logged into.\n\nThe login program is NOT responsible for removing users from the utmp file. It is the\nresponsibility of getty(8) and init(8) to clean up apparent ownership of a terminal session.\nIf you use login from the shell prompt without exec, the user you use will continue to appear\nto be logged in even after you log out of the \"subsession\".\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-f",
                        "content": "Do not perform authentication, user is preauthenticated.\n\nNote: In that case, username is mandatory.\n",
                        "flag": "-f"
                    },
                    {
                        "name": "-h",
                        "content": "Name of the remote host for this login.\n",
                        "flag": "-h"
                    },
                    {
                        "name": "-p",
                        "content": "Preserve environment.\n",
                        "flag": "-p"
                    },
                    {
                        "name": "-r",
                        "content": "Perform autologin protocol for rlogin.\n\nThe -r, -h and -f options are only used when login is invoked by root.\n",
                        "flag": "-r"
                    }
                ]
            },
            "CAVEATS": {
                "content": "This version of login has many compilation options, only some of which may be in use at any\nparticular site.\n\nThe location of files is subject to differences in system configuration.\n\nThe login program is NOT responsible for removing users from the utmp file. It is the\nresponsibility of getty(8) and init(8) to clean up apparent ownership of a terminal session.\nIf you use login from the shell prompt without exec, the user you use will continue to appear\nto be logged in even after you log out of the \"subsession\".\n\nAs with any program, login's appearance can be faked. If non-trusted users have physical\naccess to a machine, an attacker could use this to obtain the password of the next person\ncoming to sit in front of the machine. Under Linux, the SAK mechanism can be used by users to\ninitiate a trusted path and prevent this kind of attack.\n",
                "subsections": []
            },
            "CONFIGURATION": {
                "content": "The following configuration variables in /etc/login.defs change the behavior of this tool:\n",
                "subsections": [
                    {
                        "name": "CONSOLE___GROUPS (string)",
                        "content": "List of groups to add to the user's supplementary groups set when logging in on the\nconsole (as determined by the CONSOLE setting). Default is none.\n\nUse with caution - it is possible for users to gain permanent access to these groups,\neven when not logged in on the console.\n"
                    },
                    {
                        "name": "DEFAULT___HOME (boolean)",
                        "content": "Indicate if login is allowed if we can't cd to the home directory. Default is no.\n\nIf set to yes, the user will login in the root (/) directory if it is not possible to cd\nto her home directory.\n"
                    },
                    {
                        "name": "ENV___PATH (string)",
                        "content": "If set, it will be used to define the PATH environment variable when a regular user\nlogin. The value is a colon separated list of paths (for example /bin:/usr/bin) and can\nbe preceded by PATH=. The default value is PATH=/bin:/usr/bin.\n"
                    },
                    {
                        "name": "ENV___SUPATH (string)",
                        "content": "If set, it will be used to define the PATH environment variable when the superuser login.\nThe value is a colon separated list of paths (for example /sbin:/bin:/usr/sbin:/usr/bin)\nand can be preceded by PATH=. The default value is PATH=/sbin:/bin:/usr/sbin:/usr/bin.\n"
                    },
                    {
                        "name": "ERASECHAR (number)",
                        "content": "Terminal ERASE character (010 = backspace, 0177 = DEL).\n\nThe value can be prefixed \"0\" for an octal value, or \"0x\" for an hexadecimal value.\n"
                    },
                    {
                        "name": "FAIL___DELAY (number)",
                        "content": "Delay in seconds before being allowed another attempt after a login failure.\n"
                    },
                    {
                        "name": "FAKE___SHELL (string)",
                        "content": "If set, login will execute this shell instead of the users' shell specified in\n/etc/passwd.\n"
                    },
                    {
                        "name": "HUSHLOGIN___FILE (string)",
                        "content": "If defined, this file can inhibit all the usual chatter during the login sequence. If a\nfull pathname is specified, then hushed mode will be enabled if the user's name or shell\nare found in the file. If not a full pathname, then hushed mode will be enabled if the\nfile exists in the user's home directory.\n"
                    },
                    {
                        "name": "KILLCHAR (number)",
                        "content": "Terminal KILL character (025 = CTRL/U).\n\nThe value can be prefixed \"0\" for an octal value, or \"0x\" for an hexadecimal value.\n"
                    },
                    {
                        "name": "LOGIN___RETRIES (number)",
                        "content": "Maximum number of login retries in case of bad password.\n\nThis will most likely be overridden by PAM, since the default pamunix module has its own\nbuilt in of 3 retries. However, this is a safe fallback in case you are using an\nauthentication module that does not enforce PAMMAXTRIES.\n"
                    },
                    {
                        "name": "LOGIN___TIMEOUT (number)",
                        "content": "Max time in seconds for login.\n"
                    },
                    {
                        "name": "LOG___OK___LOGINS (boolean)",
                        "content": "Enable logging of successful logins.\n"
                    },
                    {
                        "name": "LOG___UNKFAIL___ENAB (boolean)",
                        "content": "Enable display of unknown usernames when login failures are recorded.\n\nNote: logging unknown usernames may be a security issue if an user enter her password\ninstead of her login name.\n"
                    },
                    {
                        "name": "TTYGROUP (string), TTYPERM (string)",
                        "content": "The terminal permissions: the login tty will be owned by the TTYGROUP group, and the\npermissions will be set to TTYPERM.\n\nBy default, the ownership of the terminal is set to the user's primary group and the\npermissions are set to 0600.\n\nTTYGROUP can be either the name of a group or a numeric group identifier.\n\nIf you have a write program which is \"setgid\" to a special group which owns the\nterminals, define TTYGROUP to the group number and TTYPERM to 0620. Otherwise leave\nTTYGROUP commented out and assign TTYPERM to either 622 or 600.\n"
                    },
                    {
                        "name": "TTYTYPE___FILE (string)",
                        "content": "If defined, file which maps tty line to TERM environment parameter. Each line of the file\nis in a format something like \"vt100 tty01\".\n"
                    },
                    {
                        "name": "USERGROUPS___ENAB (boolean)",
                        "content": "If set to yes, userdel will remove the user's group if it contains no more members, and\nuseradd will create by default a group with the name of the user.\n"
                    }
                ]
            },
            "FILES": {
                "content": "/var/run/utmp\nList of current login sessions.\n\n/var/log/wtmp\nList of previous login sessions.\n\n/etc/passwd\nUser account information.\n\n/etc/shadow\nSecure user account information.\n\n/etc/motd\nSystem message of the day file.\n\n/etc/nologin\nPrevent non-root users from logging in.\n\n/etc/ttytype\nList of terminal types.\n\n$HOME/.hushlogin\nSuppress printing of system messages.\n\n/etc/login.defs\nShadow password suite configuration.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "mail(1), passwd(1), sh(1), su(1), login.defs(5), nologin(5), passwd(5), securetty(5),\ngetty(8).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                     LOGIN(1)",
                "subsections": []
            }
        }
    }
}