login

LOGIN(1)                           ç¨æ·å½ä»¤                          LOGIN(1)



å称
       login - å¨ç³»ç»ä¸å¯å¨åè¯

大纲
       login [-p] [-h 主æº] [ç¨æ·å] [ENV=VAR...]

       login [-p] [-h 主æº] -f ç¨æ·å

       login [-p] -r 主æº

æè¿°
       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 users 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.

       After a successful login, you will be informed of any system messages
       and the presence of mail. You may turn off the printing of the system
       message file, /etc/motd, by creating a zero-length file .hushlogin in
       your login directory. The mail message will be one of "You have new
       mail.", "You have mail.", or "No Mail." according to the condition of
       your mailbox.

       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
           ä¸è¦æ§è¡è®¤è¯ï¼ç¨æ·å·²ç»é¢è®¤è¯è¿ã

           注æï¼æ¤æ¶ï¼username æ¯å¼ºå¶çã

       -h
           æ¤ç»å½çè¿ç¨ä¸»æºåã

       -p
           ä¿çç¯å¢ã

       -r
           为 rlogin (è¿ç¨ç»å½)æ§è¡ autologin (èªå¨ç»å½)åè®®ã

       -r, -h and -f åªè½ç¨äº root ä½¿ç¨ login æ¶ã

CAVEATS
       æ¤çæ¬ç login æå¾å¤ç¼è¯é项ï¼åªæä¸é¨åå¯ä»¥å¨ä»»ä½ç«ç¹ä½¿ç¨ã

       æ件çä½ç½®ç±ç³»ç»éç½®å³å®ã

       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, logins 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.

éç½®æ件
       å¨ /etc/login.defs ä¸æå¦ä¸éç½®åéï¼å¯ä»¥ç¨æ¥æ´æ¹æ¤å·¥å·çè¡ä¸ºï¼

       CONSOLE (string)
           å¦æå®ä¹äºï¼æèæ¯åå«è®¾å¤å(没è¡ä¸ä¸ª)çæ件çå®æ´è·¯å¾åï¼æè毓:”åéç设å¤åå表ãå°åªä¼å¨è¿å设å¤ä¸å许
           root ç»å½ã

           å¦æ没æå®ä¹ï¼å¯ä»¥å¨ä»»ä½è®¾å¤ä¸ä½¿ç¨ rootã

           æå®ç设å¤æ¶ä¸å¸¦ /dev/ åç¼ã

       CONSOLE_GROUPS (string)
           å¨æ§å¶å°ç»å½æ¶ï¼æ·»å å°ç¨æ·éå ç»éä¸çç»å表(å°±å¦ CONSOLE
           æç¡®å®ç)ãé»è®¤æ¯æ ã
           使ç¨æ¶éè¦æ³¨æï¼è¿å¯è½ä½¿ç¨æ·è·åè¿äºç»çæ°¸ä¹æéï¼çè³ç»å½å°çä¸æ¯æ‐
           ¤æ§å¶å°æ¶ã

       DEFAULT_HOME (boolean)
           å¦æä¸è½ cd å°ä¸»ç®å½æ¶ï¼è¯´ææ¯å¦å许ç»å½ãé»è®¤æ¯å¦ã

           å¦æ设置为 yesï¼å¦æä¸è½ cd å°ä¸»ç®å½æ¶ï¼ç¨æ·å°ä¼ç»å½å°æ ¹ç®å½(/)ã

       ENV_HZ (string)
           å¦æ设置äºï¼å°ä¼ç¨äºå¨ç¨æ·ç»å½æ¶å®ä¹ HZ ç¯å¢åéãå¼å¿é¡»ä»¥ HZ=
           å¼å¤´ãLinux ä¸ç常ç¨å¼æ¯ HZ=100ã

       ENV_PATH (string)
           If set, it will be used to define the PATH environment variable
           when a regular user login. The value is a colon separated list of
           paths (for example /bin:/usr/bin) and can be preceded by PATH=. The
           default value is PATH=/bin:/usr/bin.

       ENV_SUPATH (string)
           If set, it will be used to define the PATH environment variable
           when the superuser login. The value is a colon separated list of
           paths (for example /sbin:/bin:/usr/sbin:/usr/bin) and can be
           preceded by PATH=. The default value is
           PATH=/sbin:/bin:/usr/sbin:/usr/bin.

       ENV_TZ (string)
           å¦æ设置äºï¼å®å°ç¨äºå¨ç¨æ·ç»å½æ¶å®ä¹ TZ ç¯å¢åéãæ¤å¼å¯ä»¥æ¯ä»¥ TZ=
           å¼å¤´çæ¶åºå(ä¾å¦ TZ=CST6CDT)ï¼æèæ¯åå«æ¶åºè§åçæ件å®æ´è·¯å¾(ä¾å¦
           /etc/tzname)ã

           å¦æå°å®æ´è·¯å¾æå®ä¸ºäºä¸ä¸ªä¸åå¨æä¸å¯è¯»çæ件ï¼åé»è®¤ä½¿ç¨
           TZ=CST6CDTã

       ENVIRON_FILE (string)
           å¦ææ¤æ件åå¨ï¼å¹¶ä¸å¯è¯»ï¼å°ä¼ä»ä¸è¯»åç»å½ç¯å¢ãææè¡é½å¿é¡»æ¯
           name=value çæ ¼å¼ã

           以 # å¼å¤´çè¡å°è§ä¸ºæ³¨éï¼å¹¶è¢«å¿½ç¥ã

       ERASECHAR (number)
           ç»ç«¯æ¦é¤å符 (010 = backspace, 0177 = DEL)ã

           æ¤å¼å¯ä»¥ä½¿ç¨å缓0”表示å«è¿å¶ï¼“0x”表示ååè¿å¶ã

       FAIL_DELAY (number)
           ç»å½å¤±è´¥åï¼çå¾å¤å°ç§æåå许ç»å½ã

       FAILLOG_ENAB (boolean)
           å许ç»å½å¹¶æ¾ç¤º /var/log/faillog ç»å½å¤±è´¥ä¿¡æ¯ã

       FAKE_SHELL (string)
           å¦æ设置äºï¼login å°æ§è¡æ¤ shell èä¸æ¯å¨ /etc/passwd ä¸æå®çç¨æ·
           shellã

       FTMP_FILE (string)
           å¦æå®ä¹ï¼ç»å½å¤±è´¥ä¼ä»¥ utmp æ ¼å¼è®°å½å¨æ¤æ件ä¸ã

       HUSHLOGIN_FILE (string)
           If defined, this file can inhibit all the usual chatter during the
           login sequence. If a full pathname is specified, then hushed mode
           will be enabled if the users name or shell are found in the file.
           If not a full pathname, then hushed mode will be enabled if the
           file exists in the users home directory.

       ISSUE_FILE (string)
           å¦æå®ä¹äºï¼æ¤æ件å°å¨æ¯æ¬¡çç»å½æ示ä¹åç°å®ã

       KILLCHAR (number)
           ç»ç«¯ KILL å符 (025 = CTRL/U)ã

           æ¤å¼å¯ä»¥ä½¿ç¨å缓0”表示å«è¿å¶ï¼“0x”表示ååè¿å¶ã

       LASTLOG_ENAB (boolean)
           å许记å½åæ¾ç¤º /var/log/lastlog ç»å½æ¶é´ä¿¡æ¯ã

       LOGIN_RETRIES (number)
           å¯ç é误æ¶ï¼éè¯çæ大次æ°ã

       LOGIN_STRING (string)
           æ¤å符串ç¨äºæ示è¾å¥å¯ç ãé»è®¤æ¯ "Password: "ï¼æèç¿»è¯äºçç»æ(æ±è¯‐
           ä¸ç¿»è¯ä¸ºäº“å¯ç ï¼”)ãå¦æ设置äºæ¤åéï¼æ示ä¸ä¼è¢«ç¿»è¯ã

           å¦æå符串åå« %sï¼å°ä¼è¢«ç¨æ·åæ¿æ¢ã

       LOGIN_TIMEOUT (number)
           æ大ç»å½æ¶é´(以ç§ä¸ºåä½)ã

       LOG_OK_LOGINS (boolean)
           å许记å½æåç»å½ã

       LOG_UNKFAIL_ENAB (boolean)
           å¨è®°å½å°ç»å½å¤±è´¥æ¶ï¼å许记å½æªç¥ç¨æ·åã

           注æï¼å¦æç¨æ·ä¸å°å¿å°å¯ç è¾å¥å°äºç»å½åä¸‐
           ï¼è®°å½æªç¥ç¨æ·åå¯è½æ¯ä¸ä¸ªå®å¨éæ£ã

       MAIL_CHECK_ENAB (boolean)
           å¯ç¨ç»å½æ¶æ£æ¥åç°å®é®ç®±ç¶æã

           å¦æ shell çå¯å¨æ件已ç»æ£æ¥äºé®ä»¶("mailx -e"
           æèå¶å®ååè½çå·¥å·)ï¼æ¨åºè¯¥ç¦ç¨å®ã

       MAIL_DIR (string)
           é®ç®±ç®å½ãä¿®æ¹æå é¤ç¨æ·è´¦æ·æ¶éè¦å¤çé®ç®±ï¼å¦æ没ææå®ï¼å°ä½¿ç¨ç¼è¯æ¶æå®çé»è®¤å¼ã

       MAIL_FILE (string)
           å®ä¹ç¨æ·é®ç®±æ件çä½ç½®(ç¸å¯¹äºä¸»ç®å½)ã

       MAIL_DIR and MAIL_FILE åéç± useraddï¼usermod å userdel
       ç¨äºå建ã移å¨æå é¤ç¨æ·é®ç®±ã

       å¦æ MAIL_CHECK_ENAB 设置为 yesï¼å®ä»¬ä¹è¢«ç¨äºå®ä¹ MAIL ç¯å¢åéã

       MOTD_FILE (string)
           If defined, ":" delimited list of "message of the day" files to be
           displayed upon login.

       NOLOGINS_FILE (string)
           If defined, name of file whose presence will inhibit non-root
           logins. The contents of this file should be a message indicating
           why logins are inhibited.

       PORTTIME_CHECKS_ENAB (boolean)
           Enable checking of time restrictions specified in /etc/porttime.

       QUOTAS_ENAB (boolean)
           Enable setting of resource limits from /etc/limits and ulimit,
           umask, and niceness from the users passwd gecos field.

       TTYGROUP (string), TTYPERM (string)
           The terminal permissions: the login tty will be owned by the
           TTYGROUP group, and the permissions will be set to TTYPERM.

           By default, the ownership of the terminal is set to the users
           primary group and the permissions are set to 0600.


           TTYGROUP can be either the name of a group or a numeric group
           identifier.

           If you have a write program which is "setgid" to a special group
           which owns the terminals, define TTYGROUP to the group number and
           TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign
           TTYPERM to either 622 or 600.

       TTYTYPE_FILE (string)
           If defined, file which maps tty line to TERM environment parameter.
           Each line of the file is in a format something like "vt100 tty01".

       ULIMIT (number)
           é»è®¤ ulimit å¼ã

       UMASK (number)
           æ件模å¼å建æ©ç åå§å为æ¤å¼ãå¦æ没ææå®ï¼æ©ç åå§å为 022ã

           useradd å newusers 使ç¨æ¤æ©ç 设置å®ä»¬å建çç¨æ·ä¸»ç®å½ç模å¼ã

           ä¹è¢« login ç¨äºæå®ç¨æ·çåå§ umaskã注æï¼æ¤æ©ç å¯ä»¥è¢«ç¨æ·ç GECOS
           è¡è¦ç(å½è®¾ç½®äº QUOTAS_ENAB æ¶)ï¼ä¹å¯ä»¥è¢«å¸¦ K æ示符ç
           limits(5) å®ä¹çéå¶å¼è¦çã

       USERGROUPS_ENAB (boolean)
           å¦æ uid å gid ç¸åï¼ç¨æ·åå主ç¨æ·åä¹ç¸åï¼ä½¿é root
           ç»çç»æ©ç ä½åå±ä¸»ä½ç¸å (å¦ï¼022 -> 002, 077 -> 007)ã

           å¦æ设置为 yesï¼å¦æç»ä¸æ²¡ææåäºï¼userdel å°ç§»é¤æ¤ç¨æ·ç»ï¼useradd
           å建ç¨æ·æ¶ï¼ä¹ä¼å建ä¸ä¸ªååçé»è®¤ç»ã

æ件
       /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).



shadow-utils 4.1.5                2012-02-12                          LOGIN(1)