Progress: 0/62 (0%)

πŸ“‹ Understanding /etc/passwd and /etc/group

Understanding System Files

Linux keeps records of all users and groups in text files. Think of these files as HR spreadsheets that store essential information about system users and groups.

/etc/passwd - User Account Records

This file lists all user accounts on the system. Each line represents one user and has 7 fields, separated by colons:

username:password:x:UID:GID:comment:home_directory:shell

Breakdown of each field:

  • username β†’ Employee name
  • password β†’ Usually x (actual password stored in /etc/shadow)
  • UID β†’ Unique ID number for the user
  • GID β†’ Primary group ID
  • comment β†’ Full name or description
  • home_directory β†’ User's personal "desk"
  • shell β†’ Default working tool (bash, zsh, etc.)

Example entry:

john:x:1001:1001:John Doe:/home/john:/bin/bash

Analogy: HR record showing John's ID, team, desk, and default tool.

/etc/group - Group Records

This file lists all groups on the system. Each line has 4 fields:

group_name:password:GID:user_list

Breakdown of each field:

  • group_name β†’ Team name
  • password β†’ Rarely used; mostly empty
  • GID β†’ Group ID number
  • user_list β†’ Members of this team (comma-separated)

Example entry:

developers:x:1002:john,mary

Analogy: Team roster showing all employees in the Developers team.

Key Takeaway

  • /etc/passwd = full list of users (employees) and their info
  • /etc/group = list of groups (teams) and members
  • These files are readable, but sensitive info (passwords) is stored safely in /etc/shadow

Real-life analogy

Think of these system files like an HR department's database. The /etc/passwd file is like an employee directory listing everyone's name, ID number, department, office location, and preferred tools. The /etc/group file is like a team roster showing which employees belong to which departments or project teams. Just as HR keeps sensitive information like salaries in a separate locked file, Linux stores actual password hashes in the secure /etc/shadow file instead of the readable /etc/passwd file.

Β© All Rights preserved with Deep Cyber

Cookie Policy

This website uses cookies to ensure you get the best experience on our website.

Go It!