login - log on the computer


login [-fIpq] [-d domain] [-h hostname] [user] ...


The login(1) utility logs users on the computer system.

If no user is specified, or if a user is specified and authentication of the user fails, login(1) prompts for a user name. Authentication of users is done through passwords.

On Interix, the login(1) program displays a domain name in parentheses. If the user does not specify a domain name as part of the user name, the user is assumed to be in the displayed domain. This default domain is derived from the system registry (see NOTES later in this topic). If no registry entry exists, the result is taken from a call to getpdomain(2).

The login(1) utility takes the following options:

-d domain
Use the specified domain name instead of the default.
Force login without a password; it indicates that the proper authentication has already been done and no password need be requested. This can only be used when an already logged-in user is logging in as himself or herself.
-h hostname
Specifies that the connection was received from hostname. This option is used by various daemons, and requires appropriate privileges.
Before prompting for user, login(1) prints information about the domain+username format. If a user is supplied on the command line, login(1) prints this information only if the password is wrong.
Preserve the environment. By default, login(1) discards the previous environment.
Suppress certain messages, just as if the file .hushlogin had been found in the user's home directory.

If the file /etc/nologin exists, the content of the file is printed and the process exits, preventing login.

Normally, the login(1) utility prints the system copyright notice and notifies the user of new mail, and indicates whether either the account or the password will expire in the next two days. If the file .hushlogin exists in the user's home directory, these messages are not displayed.

The login(1) utility enters information into the environment specifying the user's home directory (HOME), command interpreter (SHELL), search path (PATH), terminal type (TERM) and user name (both LOGNAME and USER).

The standard shells, csh(1) and sh(1), contain a special built-in command and an alias, respectively, for login. If you invoke login in this manner, the shells do not fork before executing the login(1) utility.


The following files are used by login(1):

If this file exists, login(1) prints the content of the file and the process exits.
If this file exists, a "quiet" login is performed (this disables the checking of mail and the printing of the last login time and message of the day).


The default domain presented in the login banner can be changed by setting the Windows registry variable HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services For Unix\PrincipalDomain to the name of the domain.