Files Controlling User Accounts and Groups

On Red Hat Linux, information about user accounts and groups are stored in several text files within the /etc/ directory. When a system administrator creates new user accounts, these files must either be edited by hand or applications must be used to make the necessary changes.

The following section document the files in the /etc/ directory that store user and group information under Red Hat Linux.

/etc/passwd

The /etc/passwd file is world-readable, and contains a list of users, each on a separate line. On each line is a seven field, colon delimited list which contains the following information:

Here is an example of a /etc/passwd entry:

root:x:0:0:root:/root:/bin/bash

This line shows that the root user has a shadow password, as well as a UID and GID of 0. The root user has /root/ as a home directory, and uses /bin/bash for a shell.

For more information about /etc/passwd, type man 5 passwd.

/etc/shadow

The /etc/shadow file is readable only by the root user, and contains password and optional password aging information. As in the /etc/passwd file, each user's information is on a separate line. Each of these lines is a nine field, colon delimited list including the following information:

Here is an example line from /etc/shadow:

juan:$1$.QKDPc5E$SWlkjRWexrXYgc98F.:11956:0:90:5:30:12197:

This line shows the following information for user juan:

For more information on the /etc/shadow file, type man 5 shadow.

/etc/group

The /etc/group is world-readable, and contains a list of groups, each on a separate line. Each line is a four field, colon delimited list including the following information:

Here is an example line from /etc/group:

general:x:502:juan,shelley,bob

This line shows that the general group is using shadow passwords, has a GID of 502, and that juan, shelley, and bob are members.

For more information on /etc/group, type man 5 group.

/etc/gshadow

The /etc/gshadow file is readable only by the root user, and contains an encrypted password for each group, as well as group membership and administrator information. Just as in the /etc/group file, each group's information is on a separate line. Each of these lines is a four field, colon delimited list including the following information:

Here is an example line from /etc/gshadow:

general:!!:shelley:juan,bob

This line shows that the general group has no password and does not allow non-members to join using the newgrp command. In addition, shelley is a group administrator, and juan and bob are regular, non-administrative members.

Since editing these files by hand raises the potential for syntax errors, it is recommended that the applications provided with Red Hat Linux for this purpose be used instead. The next section reviews the primary tools for performing these tasks.

Notes

[1]

GECOS stands for General Electric Comprehensive Operating System.