Creating new sessions and logging in are typical tasks while working with UNIX systems, especially if numerous individuals are working on the same workstation. The necessary user credentials and permissions must be stored in the database by the operating system. In this article, we will look at the login command, which assists the operating system in performing the tasks listed above. We'll also go through what events occur when you type this command and hit enter.
What does the login command do?
This command is used to create a new session in your UNIX Operating System. Only the users who are present on the machine can be logged in using this command. We can even specify the Environment Variables for a user while writing this command. The environment variables can be specified as a key-value pair in the command. This command is an alternative to the user switching commands in UNIX. The syntax for the command is:
$ login [options] username
This command requires root access. If no argument is provided with the command, this command will prompt you for the username.
The sequence of Events for the command
The Operating System ensures that the logins for the specified user are enabled properly and other authentication schemes are enabled.
The credentials of the user are verified against the database. The user provides a new password if the previous password is expired by any chance.
The Operating System verifies all the access rights and permissions for the specified user.
The Operating System initiates the session, including environment variables specified by the users.
Flags associated with the command
This is used to specify the user on a remote server. This is a useful flag associated with this command that allows you to login on remote servers and machines with your terminal.
To specify the Operating System to not delete environment variables
To tell that the user has already logged in and this avoids entering the password again.
Directories and related information stored in them
|login command is present here
|account related information is present here
|This place contains the respective passwords
|Environment configuration related data is stored here
|Contains the data regarding recent login attempts
|Contains the data regarding unsuccessful logics
This article went through the description of the login command in UNIX. This command is helpful in creating sessions with the existing users in the database. It even provides features such as remote login, and caching passwords of users to avoid logging in again and again. We also went through the directories and the related information contained in them.
People are also reading: