Manpages

名 称

login - 在 系 统 上 启 动 回 话

大 纲

login [-p] [-h host] [username] [ENV=VAR...]

login [-p] [-h host] -f username

login [-p] -r host

描 述

The login program is used to establish a new session with the system. It is normally invoked automatically by responding to the login: prompt on the user's terminal. login may be special to the shell and may not be invoked as a sub-process. When called from a shell, login should be executed as exec login which will cause the user to exit from the current shell (and thus will prevent the new logged in user to return to the session of the caller). Attempting to execute login from any shell but the login shell will produce an error message.

The user is then prompted for a password, where appropriate. Echoing is disabled to prevent revealing the password. Only a small number of password failures are permitted before login exits and the communications link is severed.

If password aging has been enabled for your account, you may be prompted for a new password before proceeding. You will be forced to provide your old password and the new password before continuing. Please refer to passwd(1) for more information.

Your user and group ID will be set according to their values in the /etc/passwd file. The value for $HOME, $SHELL, $PATH, $LOGNAME, and $MAIL are set according to the appropriate fields in the password entry. Ulimit, umask and nice values may also be set according to entries in the GECOS field.

On some installations, the environmental variable $TERM will be initialized to the terminal type on your tty line, as specified in /etc/ttytype. 命 令 解 释 器 的 初 始 化 脚 本 也 可 能 执 行 。 请 参 考 手 册 中 相 应 的 章 节 来 获 取 关 于 此 功 能 的 更 多 信 息 。 在 登 录 shell 中 以 第 一 个 字 符 是 “*”标 注 的 是 子 系 统 登 录 。 给 定 的 主 目 录 将 被 用 于 用 户 实 际 登 录 的 新 文 件 系 统 的 根 。

The login program is NOT responsible for removing users from the utmp file. It is the responsibility of getty(8) and init(8) to clean up apparent ownership of a terminal session. If you use login from the shell prompt without exec, the user you use will continue to appear to be logged in even after you log out of the "subsession".

选 项

-f 不 要 执 行 认 证 , 用 户 已 经 预 认 证 过 。

Note: In that case, username is mandatory.

-h 此 登 录 的 远 程 主 机 名 。

-p 保 留 环 境 。

-r 为 rlogin (远 程 登 录 )执 行 autologin (自 动 登 录 )协 议 。

The -r, -h and -f options are only used when login is invoked by root.

CAVEATS

This version of login has many compilation options, only some of which may be in use at any particular site. 文 件 的 位 置 由 系 统 配 置 决 定 。

The login program is NOT responsible for removing users from the utmp file. It is the responsibility of getty(8) and init(8) to clean up apparent ownership of a terminal session. If you use login from the shell prompt without exec, the user you use will continue to appear to be logged in even after you log out of the "subsession".

As with any program, login's appearance can be faked. If non-trusted users have physical access to a machine, an attacker could use this to obtain the password of the next person coming to sit in front of the machine. Under Linux, the SAK mechanism can be used by users to initiate a trusted path and prevent this kind of attack.

配 置 文 件

The following configuration variables in /etc/login.defs change the behavior of this tool:

文 件

/var/run/utmp 当 前 登 录 会 话 的 列 表 。

/var/log/wtmp 先 前 的 登 录 会 话 列 表 。

/etc/passwd 用 户 账 户 信 息 。

/etc/shadow 安 全 用 户 账 户 信 息 。

/etc/motd

System message of the day file.

/etc/nologin 阻 止 非 root 用 户 登 录 。

/etc/ttytype 终 端 类 型 列 表 。

$HOME/.hushlogin 阻 止 显 示 系 统 信 息 。

/etc/login.defs

Shadow 密 码 套 件 配 置 。

参 见

mail(1), passwd(1), sh(1), su(1), login.defs(5), nologin(5), passwd(5), securetty(5), getty(8).