This tutorial explains Linux “login” command, options and its usage with examples.
login is used when signing onto a system. It can also be used to switch from one user to another at any time (most modern shells have support for this feature built into them, however).
If an argument is not given, login prompts for the username.
If the user is not root, and if /etc/nologin exists, the contents of this file are printed to the screen, and the login is terminated. This is typically used to prevent logins when the system is being taken down.
After these conditions have been checked, the password will be requested and checked (if a password is required for this username). Ten attempts are allowed before login dies, but after the first three, the response starts to get very slow. Login failures are reported via the syslog facility. This facility is also used to report any successful root logins. An initialization script for your command interpreter may also be executed.
login [ -p ] [ -d device ] [ name [ environ ] ]
Used to pass environment variables to the login shell.
login accepts a device option, device. device is taken to be the path name of the TTY port login is to operate on.
1. To log in to the system as user abc, enter the following at the login prompt
If a password is defined, the password prompt appears. Enter your password at this prompt.
2. Attempt to login to a domain
$ login xyz.com
Would attempt to login to the xyz domain.
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.