Linux

What information is stored in /etc/passwd? explain each field

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

/etc/passwd is a configuration file, which contains users information. Each entry in this file has, 7 fields,

username:password:UID:GID:Comment:home directory:shell

username - The name of the user.

password - This field is actually a placeholder of the password field. Due to security concerns, this field does not contain the password, just a placeholder (x) to the encrypted password stored in /etc/shadow file.

UID - User ID of the user.

GID - Group ID

Comment - This field is to provide description about the user.

home directory - Abousulte path of the user's home directory. This directory gets created once the user is added.

shell - This field contains the absolute path of the shell that will be used by the respective user.