The Blog

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.

  1. A user id is assigned to it [value >1000]
  2. A group is created with a Group Id
  3. That user is assigned to this newly created group
  4. A home directory is created for that user [default path is /home]
  5. 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

  1. Username
  2. Password
  3. UID
  4. GID
  5. Comments
  6.  User’s home directory [absolute path]
  7. 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

  1. User name
  2. Password
  3. Encrypted password.
  4. Previous Password Change
  5. Validity of password
  6. Warning period
  7. Account validity
  8. 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!

Leave a Comment

Your email address will not be published.

×

Powered by WhatsApp Chat

× How can I help you?