login
1. login.1.man
Manpage of LOGIN
LOGIN
Section: User Commands (1)Updated: 10/28/2007
Index Return to Main Contents
NAME
login - begin session on the systemSYNOPSIS
-
login [-p] [username] [ENV=VAR...]
- login [-p] [-h host] [-f username]
- login [-p] -r host
- login [-p] [-h host] [-f username]
DESCRIPTION
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.
An initialization script for your command interpreter may also be executed. Please see the appropriate manual section for more information on this function.
A subsystem login is indicated by the presence of a "*" as the first character of the login shell. The given home directory will be used as the root of a new file system which the user is actually logged into.
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".
OPTIONS
-f
- Do not perform authentication, user is preauthenticated.
-h
- Name of the remote host for this login.
-p
- Preserve environment.
-r
- Perform autologin protocol for rlogin.
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 location of files is subject to differences in system configuration.
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.
FILES
/var/run/utmp
- List of current login sessions.
/var/log/wtmp
- List of previous login sessions.
/etc/passwd
- User account information.
/etc/shadow
- Secure user account information.
/etc/motd
- System message of the day file.
/etc/nologin
- Prevent non-root users from logging in.
/etc/ttytype
- List of terminal types.
$HOME/.hushlogin
- Suppress printing of system messages.
SEE ALSO
mail(1), passwd(1), sh(1), su(1), login.defs(5), nologin(5), passwd(5), securetty(5), getty(8).
Index
This document was created by man2html using the manual pages.
Time: 23:21:30 GMT, July 09, 2008
2. login.3.man
Manpage of LOGIN
LOGIN
Section: Linux Programmer's Manual (3)Updated: 2004-05-06
Index Return to Main Contents
NAME
login, logout - write utmp and wtmp entriesSYNOPSIS
#include <utmp.h>void login(const struct utmp *ut);
int logout(const char *ut_line);
DESCRIPTION
The utmp file records who is currently using the system. The wtmp file records all logins and logouts. See utmp(5).The function login() takes the supplied struct utmp, ut, and writes it to both the utmp and the wtmp file.
The function logout() clears the entry in the utmp file again.
GNU Details
More precisely, login() takes the argument ut struct, fills the field ut->ut_type (if there is such a field) with the value USER_PROCESS, and fills the field ut->ut_pid (if there is such a field) with the process ID of the calling process. Then it tries to fill the field ut->ut_line. It takes the first of stdin, stdout, stderr that is a tty, and stores the corresponding pathname minus a possible leading /dev/ into this field, and then writes the struct to the utmp file. On the other hand, if no tty name was found, this field is filled with "???" and the struct is not written to the utmp file. After this, the struct is written to the wtmp file.The logout() function searches the utmp file for an entry matching the ut_line argument. If a record is found, it is updated by zeroing out the ut_name and ut_host fields, updating the ut_tv timestamp field and setting ut_type (if there is such a field) to DEAD_PROCESS.
RETURN VALUE
The logout() function returns 1 if the entry was successfully written to the database, or 0 if an error occurred.FILES
- /var/run/utmp
- user accounting database, configured through _PATH_UTMP in <paths.h>
- /var/log/wtmp
- user accounting log file, configured through _PATH_WTMP in <paths.h>
CONFORMING TO
Not in POSIX.1-2001. Present on the BSDs.NOTES
Note that the member ut_user of struct utmp is called ut_name in BSD. Therefore, ut_name is defined as an alias for ut_user in <utmp.h>.SEE ALSO
getutent(3), utmp(5)COLOPHON
This page is part of release 2.78 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.
Index
This document was created by man2html using the manual pages.
Time: 23:21:30 GMT, July 09, 2008


