Users In Linux
If you want to login to a system, you need to login using a username and password. User can be created using adduser or useradd commands in Linux. Let us see what happens when you create a user.
- A user id is assigned to it [value >1000]
- A group is created with a Group Id
- That user is assigned to this newly created group
- A home directory is created for that user [default path is /home]
- Contents of /etc/skel is copied to this home directory
Let us now check when a user is created, and which files get affected, let us have a look at files where a new entry is generated in which files.
/etc/passwd
This is a file where you can get all the details of the users in your system. Be it the normal users, system users or the root user.
Syntax:
{username}:{password}:{UID}:{GID}:{GECOS}:{home_dir}:{shell_path}
Let us go through the fields of this file
- Username
- Password
- UID
- GID
- Comments
- User’s home directory [absolute path]
- Login shell
/etc/shadow
This is a file where we store the password securely.
Syntax:
{username}:{enc_pwd}:{last_pwd_change}:{pwd_validity}:{warn_date}:{acc_validity}:{acc_disablity}
Let us go through the fields of this file
- User name
- Password
- Encrypted password.
- Previous Password Change
- Validity of password
- Warning period
- Account validity
- Account disability
In DevOps Gurukul, we focus on giving hands-on experience while studying so that when you enter the industry, you won’t feel the pressure. DevOps Gurukul is one of the best training academies which provides Linux Training In Kerala and Linux Server Administration course. We have experienced training professionals who are passionate about grooming the right candidates to start their successful careers. Come learn with us and have a bright future!