LOGIN(1) — USER COMMANDS
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 userID 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).)
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 /usr/bin/sh or /usr/bin/csh) 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. For example, if the file contained:
console"/etc/getty Console-9600"sunon secure
tty00"/etc/getty Console-9600"sunon
...
the super-user could only log in on the console.
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
/var/spool/mail/∗ mail
/etc/motd message-of-the-day
/etc/passwd password file
/etc/nologin stop login, print message
~/.hushlogin makes login quieter
/usr/bin/sh
/usr/bin/csh
.login
.profile
SEE ALSO
csh(1), mail(1), passwd(1), quota(1), rlogin(1C), sh(1), uucp(1C), passwd(5), environ(5V), utmp(5), init(8), getty(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.
Sun Release 4.0 — Last change: 25 March 1989