User and Group Management Tools

Managing users and groups can be a tedious task; this is why Community Enterprise Linux provides tools and conventions to make them easier to manage.

The easiest way to manage users and groups is through the graphical application, User Manager (system-config-users). For more information on User Manager, refer to .

The following command line tools can also be used to manage users and groups:

Command Line Configuration

If you prefer command line tools or do not have the X Window System installed, use this section to configure users and groups.

Adding a User

To add a user to the system:

  1. Issue the useradd command to create a locked user account:
useradd <username>

Adding a Group

To add a group to the system, use the command groupadd:

groupadd <group-name>

Command line options for groupadd are detailed in .

Table 35.2. groupadd Command Line Options

Option Description
-g <gid> Group ID for the group, which must be unique and greater than 499
-r Create a system group with a GID less than 500
-f When used with -g <gid> and <gid> already exists, groupadd will choose another unique <gid> for the group.

Password Aging

For security reasons, it is advisable to require users to change their passwords periodically. This can be done when adding or editing a user on the Password Info tab of the User Manager.

To configure password expiration for a user from a shell prompt, use the chage command with an option from , followed by the username.

Shadow passwords must be enabled to use the chage command. For more information, see .

Table 35.3. chage Command Line Options

Option Description
-m <days> Specifies the minimum number of days between which the user must change passwords. If the value is 0, the password does not expire.
-M <days> Specifies the maximum number of days for which the password is valid. When the number of days specified by this option plus the number of days specified with the -d option is less than the current day, the user must change passwords before using the account.
-d <days> Specifies the number of days since January 1, 1970 the password was changed
-I <days> Specifies the number of inactive days after the password expiration before locking the account. If the value is 0, the account is not locked after the password expires.
-E <date> Specifies the date on which the account is locked, in the format YYYY-MM-DD. Instead of the date, the number of days since January 1, 1970 can also be used.
-W <days> Specifies the number of days before the password expiration date to warn the user.
-l Lists current account aging settings.

If the chage command is followed directly by a username (with no options), it displays the current password aging values and allows them to be changed interactively.

You can configure a password to expire the first time a user logs in. This forces users to change passwords immediately.

  1. Set up an initial password - There are two common approaches to this step. The administrator can assign a default password or assign a null password.

To assign a default password, use the following steps:

Python 2.4.3 (#1, Jul 21 2006, 08:46:09)
[GCC 4.1.1 20060718 (CentOS 4.1.1-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Alternatively, you can assign a null password instead of an initial password. To do this, use the following command:

usermod -p "" username

Using a null password, while convenient, is a highly unsecure practice, as any third party can log in first an access the system using the unsecure username. Always make sure that the user is ready to log in before unlocking an account with a null password.

Explaining the Process

The following steps illustrate what happens if the command useradd juan is issued on a system that has shadow passwords enabled:

  1. A new line for juan is created in /etc/passwd. The line has the following characteristics: