LOGIN(1)

NAME
login - log in to the system

SYNOPSIS
login [ -p ] [ username ]

DESCRIPTION

login signs username on to the system initially; login may also be used at any time to change from one user ID to another.

When used with no argument, login requests a user name and password (if appropriate). Echoing is turned off (if possible) while typing the password. Note: the number of significant characters in a password is 8. See passwd(1).

If password aging is enabled and the password corresponding to the user name has expired, the user will be prompted for a new password. The user has to successfully modify his password for login to proceed. See passwd(1).

When successful, login updates accounting files, prints disk usage and limits (by running quota(1),) prints the message of the day, informs you of the existence of any mail, and displays the time you last logged in. None of these messages is printed if there is a .hushlogin file in your home directory. This is mostly used to make life easier for nonhuman users, such as uucp(1C).

login initializes the user and group IDs and the working directory, then starts a command interpreter shell (usually either sh(1) or csh(1)) according to specifications found in the file /etc/passwd. Argument 0 of the command interpreter is the name of the command interpreter with a leading dash (`-') prepended.

login also modifies the environment (environ(5V)) with information specifying home directory, command interpreter, terminal-type (if available) and username. The -p argument preserves the remainder of the environment, otherwise any previous environment is discarded.

The super-user root may only log in on those terminals marked as “secure” in the /etc/ttytab file. Otherwise, the super-user must log in as an ordinary user and become super-user using su(1v). For example, if the file contained:

    console	"/etc/getty Console-9600"	sun	on secure
    tty00	"/etc/getty Console-9600"	sun	on
    ...

the super-user could only log in directly on the console. See ttytab(5) for a discussion of “secure” and other getty(8) options used in /etc/ttytab.

If the file /etc/nologin exists, login prints its contents on the user's terminal and exits. This is used by shutdown(8) to stop logins when the system is about to go down.

The login command, recognized by sh(1) and csh(1), is executed directly (without forking), and terminates that shell. To resume working, you must log in again.

login times out and exits if its prompt for input is not answered within a reasonable time.

When the Bourne shell (sh) starts up, it reads a file called .profile from your home directory (that of the username you use to log in). When the C shell (csh) starts up, it reads a file called .cshrc from your home directory, and then reads a file called .login.

The shells read these files only if they are owned by the person logging in.

OPTIONS

-p  Preserve any existing environment variables and their values; otherwise the previous environment is discarded.

FILES
/etc/utmp
    accounting
/var/adm/wtmp
    accounting
/var/adm/lastlog
    time of last login
/etc/ttytab
    terminal types
/usr/ucb/quota
    quota check
/var/spool/mail/*
    mail
/etc/motd
    message-of-the-day
/etc/passwd
    password file
/etc/nologin
    stop login, print message
~/.hushlogin
    makes login quieter
.login
.profile

SEE ALSO
csh(1), mail(1), passwd(1), quota(1), rlogin(1C), sh(1), uucp(1C), environ(5V), fbtab(5), passwd(5), svdtab(5), utmp(5V), getty(8), init(8), shutdown(8)

DIAGNOSTICS

Login incorrect
    If the name or the password is bad (or mistyped).

No Shell

cannot open password file

no directory
    Ask your system administrator for assistance.

NOTES

The following options are undocumented, and not intended for the user. The -r option is used by the remote login server, rlogind(8C) to force login to enter into an initial connection protocol. -h is used by telnetd(8C) and other servers to list the host from which the connection was received.

The following warnings apply when login account names contain characters outside the range of 7-bit ASCII:

•   A user cannot rlogin to account-name containing 8-bit characters from a system that does not handle 8-bit characters.

•   A user cannot log in to account-name containing 8-bit characters from a 7-bit ASCII terminal (through a modem, for example).

•   Several parts of the C library are not tested for 8-bit user names.

•   Codeset mapping can vary between systems, so an 8-bit pattern can represent different characters on different sytems.

•   Password algorithms do not work with 8-bit characters in the password.