login(1)
NAME
login − log in to a system
SYNTAX
login [username]
DESCRIPTION
The login command is used when a user initially signs on, or it may be used at any time to change from one user to another. The latter case is the one summarized above and described here. To sign on initially, see the Guide to System Environment Setup.
If login is invoked without an argument, it asks for a user name, and, if appropriate, a password. Echoing is turned off (if possible) during the typing of the password, so it does not appear on the written record of the session.
After a successful login, accounting files are updated and the user is informed of the existence of mail, and the message of the day is printed, as is the time he last logged in (unless he has a “.hushlogin” file in his home directory − this is mostly used by facilities, such as uucp ).
The login command initializes the user and group IDs and the working directory, then executes a command interpreter, usually sh(,), according to specifications found in a password file. Argument 0 of the command interpreter is “−sh”, or more generally the name of the command interpreter with a leading dash (“−”) prepended.
The login command also initializes the environment environ() with information specifying home directory, command interpreter, terminal type (if available) and user name.
When login is used in conjunction with getty() it is the responsibility of the getty program to initialize the terminal attributes. Specifically if a terminal is setup to use 8-bit characters the getty program should use a gettytab() entry which specifies 8-bit characters. If a terminal is setup in 8-bit mode but fails to specify an 8-bit gettytab entry, then characters output by both login and getty may appear as multinational characters.
If the file /etc/nologin exists, login prints its contents on the user’s terminal and exits. This is used by shutdown() to stop users logging in when the system is about to go down.
The login command is recognized by sh() and csh() and executed directly (without forking).
If a root login is attempted and an invalid command interpreter is specified, the sh interpreter is used.
OPTIONS
−rUsed by the remote login server, rlogind(,), to force login to enter into an initial connection protocol.
−P <programname>Causes login to set it’s standard input and output to be connected to the prompting program <programname>.
−C stringAllows the system to specify a command to be run using the user’s shell. This option causes a user shell -c string to be exec’ed.
RESTRICTIONS
To provide flow control, CTRL/S and CTRL/Q are ignored and are therefore invalid characters in a login name.
DIAGNOSTICS
“Login incorrect,” if the name or the password is bad.
“No Shell”, “cannot open password file”, “no directory”: consult the system administrator. These errors are typically the result of incomplete system setup. The “No Shell” message indicates that the specified command interpreter does not exist. The “no directory” message indicates that the user does not have a propper home directory setup on this machine, this could appear for example if the home directory is NFS served and the NFS server is not presently available.
FILES
/etc/utmpaccounting
/usr/adm/wtmpaccounting
/usr/spool/mail/*mail
/etc/motdmessage-of-the-day
/etc/passwdpassword file
/etc/nologinstops logins
.hushloginmakes login quieter
/etc/securettylists ttys that root may log in on
SEE ALSO
mail(1), passwd(1), yppasswd(1yp), passwd(5yp), environ(7), getty(8), init(8), rlogind(8c), shutdown(8)
Guide to System Environment Setup
Commands