Your Course Progress

Topics
0 / 0
0.00%
Practice Tests
0 / 0
0.00%
Tests
0 / 0
0.00%
Assignments
0 / 0
0.00%
Content
0 / 0
0.00%
% Completed

Linux User and Group Management

This article provides a comprehensive guide to managing users and groups in Linux. We will cover essential commands and best practices for administering user accounts and permissions.

Linux User and Group Management

Introduction

This article provides a comprehensive guide to managing users and groups in Linux. We will cover essential commands and best practices for administering user accounts and permissions.

Creating Users and Groups

useradd

The useradd command is used to create new users. Here's an example:

useradd john

This creates a user named 'john'. You can add options like -m to create a home directory, -g to specify the group, and more. See man useradd for details.

groupadd

The groupadd command creates new groups. For example:

groupadd developers

This creates a group named 'developers'.

Do You Know?

You can specify the user's UID and GID when creating a user for better control over system resources.

Managing Passwords and Permissions

passwd

The passwd command allows you to change passwords. You can change your own password using passwd, or change another user's password using sudo passwd username.

passwd john

chage

The chage command is used to manage password expiry settings. You can use it to set the minimum and maximum password age.

chage -m 7 -M 90 john

This sets the minimum password age to 7 days and the maximum to 90 days for user 'john'.

Important Note

Always follow your organization's security policies when setting password expiry policies.

Avoid This

Avoid using weak or easily guessable passwords.

Hands-on: Configuring User Roles and Access

Let's configure user roles and access. This involves assigning users to groups and granting permissions using chmod and chown commands. For example, we will add the user 'john' to the 'developers' group:

usermod -a -G developers john

This adds user 'john' to the 'developers' group without removing him from any existing groups.

Summary

  • Learned how to create users and groups using useradd and groupadd.
  • Understood how to manage passwords using passwd and password expiry using chage.
  • Gained practical experience in configuring user roles and access control.

Discussion