Lesson 1, Topic 1
In Progress

Manage Users and Groups

1. User Account Management

User accounts serve as the primary method for individuals to access and interact with the operating system.

a. Creating a Local User Account

Local user accounts are stored and managed on the individual system, as opposed to centralized user management systems like LDAP.

Example:

# Create a new user named 'john'
useradd john

b. Deleting a Local User Account

Removing a local user account restricts access and can free up system resources.

Example:

# Delete the user 'john' and remove his home directory
userdel -r john

c. Modifying a Local User Account

Changes can be made to existing user accounts to adjust settings like the home directory, shell, and more.

Example:

# Change the home directory for user 'john' to '/data/john'
usermod -d /data/john john


2. Password Management

Passwords are a fundamental security measure for user accounts.

a. Changing Passwords

Example:

# Change password for user 'john'
passwd john

b. Adjusting Password Aging

Password aging controls how long a password is valid and forces users to change passwords periodically.

Example:

# Set the password for 'john' to expire after 60 days
chage -M 60 john


3. Group Management

Groups are collections of user accounts, simplifying permissions management.

a. Creating Local Groups

Example:

# Create a new group named 'developers'
groupadd developers

b. Deleting Local Groups

Example:

# Remove the 'developers' group
groupdel developers

c. Modifying Group Memberships

Adjusting which users are part of a group.

Example:

# Add user 'john' to the 'developers' group
usermod -aG developers john


4. Superuser Access Configuration

The superuser (often termed as ‘root’) has unrestricted access to the system.

a. sudo Configuration

sudo allows specified users to execute commands as another user, including the superuser.

Example:

# Allow 'john' to execute any command as root
echo "john ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/john


Practical Exercise

  1. Create three users: alice, bob, and charlie.
  2. Create a group named ‘team’.
  3. Add alice and bob to ‘team’, but not charlie.
  4. Configure sudo access for charlie but restrict it for alice and bob.

Summary

Managing user accounts and groups is crucial in a multi-user environment. It ensures proper access controls, balanced system resource utilization, and enhanced security. From creating and deleting accounts to configuring superuser access, mastery of these tasks is essential for system administrators.

Key Points

  1. User accounts and groups simplify permissions and resource allocation.
  2. Regularly changing and aging passwords enhances system security.
  3. Proper superuser access configuration prevents potential system threats.