/etc/passwd file in Linux

The ‘/etc/passwd‘ file in Linux contains user and user related information.

An entry in /etc/passwd file contains seven entries/fields and looks like:

a:b:c:d:e:f:g

a → Username

username is between 1 and 32 characters in length.

b → Password

an ‘x‘ character indicates that encrypted password is stored in /etc/shadow file.

c → User ID (UID)

Each user is assigned a user ID (UID). UID 0 (zero) is reserved for root and UIDs 1-99 are reserved for other predefined accounts. UID 100-999 are reserved by system for administrative and system accounts/groups. Therefore, other users except the root has UIDs greater than 1000.

d → Group ID (GID)

The primary group ID (stored in /etc/group file)

e → User Group Info

The comment field. It allow us to add extra information about the users such as user’s full name, phone number etc.

f → Home Directory

The absolute path to the directory the user will be assigned when they log in. If this directory does not exists then the users directory becomes /

g → Shell / Command

The absolute path of a command or shell. The shell that the particular user will be assigned upon logon. E.g. /bin/bash; /bin/sh; /usr/sbin/nologin; /bin/false; etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: