Published on

Attributes of a User Account in Linux

Authors
  • Name
    Eche Ngbede
    Twitter

The /etc/passwd file in Linux contains information about user accounts on the system. Each line in the file represents a user account and is composed of several fields separated by colons (:). The fields in the /etc/passwd file include:

  • User name: This field represents the username or login name for the user account.
  • User password: In modern Linux systems, an "x" is typically stored in this field instead of the actual password. The encrypted password is stored in the /etc/shadow file for security reasons.
  • UID (User ID): The UID is a unique numeric identifier assigned to the user account. It helps identify the user account within the system.
  • GID (Group ID): The GID represents the primary group ID associated with the user account. It determines the user's default group.
  • Comment or GECOS information: This field typically contains additional information about the user, such as the user's full name, contact information, or other details. It is also known as the GECOS (General Electric Comprehensive Operating System) field.
  • Home directory: The home directory is the location where the user's files and personal configurations are stored. It serves as the initial working directory when the user logs in.
  • Login shell: The login shell defines the command interpreter or shell that is used when the user logs in. It determines the user's command line environment and interactive session behavior.

Here's an example entry in the /etc/passwd file:

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

In this example:

  • Username: john
  • User password: x (stored in /etc/shadow)
  • UID: 1001
  • GID: 1001
  • Comment/GECOS: John Smith
  • Home directory: /home/john
  • Login shell: /bin/bash