The login utility logs users (and pseudo-users) into the computer system. If no user is specified, or if a user is specified and authentication of the user fails, login prompts for a user name. Authentication of users is configurable via pam. Password authentication is the default.
If the file /etc/nologin exists, login displays its contents to the user and exits. This is used by shutdown(8) to prevent users from logging in when the system is about to go down.
If you encounter the below error while running the command login:
login: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install login |
Ubuntu | apt-get install login |
Alpine | apk add util-linux |
Arch Linux | pacman -S util-linux |
Kali Linux | apt-get install login |
CentOS | yum install util-linux |
Fedora | dnf install util-linux |
OS X | brew install util-linux |
Raspbian | apt-get install login |
login Command Examples
1. Log in as a user:
# login user
2. Log in as user without authentication if user is preauthenticated:
# login -f user
3. Log in as user and preserve environment:
# login -p user
4. Log in as a user on a remote host:
# login -h host user