Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

Linux IntroductionChapter 4. User, Group and Permission

Chapter 4. User, Group and Permission

Managing User, Group, and Permissions in Linux

Managing users, groups, and permissions is a key aspect of administering Linux systems. In this chapter, we’ll cover how to set up and manage users, assign them to appropriate groups, and configure file permissions to control access. Whether you're a beginner or looking to solidify your understanding, this chapter will provide the foundational knowledge necessary for system administration tasks. By the end of this chapter, you’ll be able to effectively manage users and their permissions on your Linux system.

What We Cover in This Chapter

The following topics are covered in this chapter:

What Are User, Group, and Permission in Linux?

In this section, we'll explain the fundamental concepts of users, groups, and permissions in Linux. We’ll look at the differences between the superuser and normal users, how users are grouped together, and how file access is managed based on user status.

Permission (Access Mode) by Owner Status

We’ll cover how file permissions are set based on file ownership. You’ll learn about the three types of users: Owner, Owner Group, and Others, and how their permissions differ when accessing files and directories.

Superuser (Root User) vs. Normal User

This section explains the distinction between the superuser (root) and normal users. It clarifies the permissions and privileges of each type and shows how they affect system operations.

sudo (Run Command with Superuser Privileges)

We will introduce the sudo command, which allows normal users to execute commands with superuser privileges. You will also learn about the configuration of sudoers and the visudo command to manage sudo access.

su (Switch User)

The su command allows users to switch to another user account temporarily. In this section, we’ll explore how the su command works for switching between user accounts, including switching to the superuser account.

useradd (Add User)

The useradd command is used to create a new user, and in this section, we’ll show you how to add users, manage user data, and check the user information stored in the /etc/passwd file.

passwd (Set Password)

We’ll demonstrate how to set up passwords for users using the passwd command. We’ll also show you how to manage user passwords, including resetting, changing, and locking accounts.

userdel (Delete User)

Learn how to safely delete users and their home directories using the userdel command.

Group – Primary Group and Secondary Group

Understanding the roles of Primary and Secondary groups is essential for managing user permissions efficiently. We’ll dive into how groups affect file and directory access.

groupadd (Add Group)

The groupadd command lets you create new groups in the system. We'll explore how to manage groups and check group information using commands like cat /etc/group and grep.

usermod (Modify User Account Information)

The usermod command is used to modify user account details, including adding users to groups and changing user IDs.

gpasswd (Add and Delete Users to Group)

In this section, we’ll show you how to manage group memberships using the gpasswd command to add or remove users from groups.

groupdel (Delete Group)

Learn how to delete unnecessary groups from your system using the groupdel command and understand the implications of removing groups.

chown (Change Owner of File and Directory)

The chown command is used to change the ownership of files and directories. This section demonstrates how to change ownership of individual files as well as entire directories recursively.

chgrp (Change Group of File and Directory)

We’ll explore how to change the group ownership of files and directories using the chgrp command, and when to use the -R option to apply changes recursively.

chmod (Change Access Mode)

Learn how to control file permissions using the chmod command. This section covers both symbolic and numeric methods for changing file access permissions.

chmod Command with Numbers

Here, we'll discuss how to use numeric values (like 755, 644, etc.) to represent file permissions, making it easier to manage permissions for multiple files and directories.

w and who (Check Current User Login Status)

The w and who commands allow system administrators to check the login status of users and view their current activities on the system.

id and groups (Check User ID and Group)

The id and groups commands provide detailed information about a user’s groups and user ID, helping you verify current user settings.

getent (Display User and Group Data)

The getent command can be used to query various databases, including user and group data, allowing you to check user and group information efficiently.

Learn offline for better focus!
A book for this course is available on Amazon.

Linux Visual Guide

Step-By-Step Manual for Complete Beginners to Mastering Linux Basics, Vim Editor, Command Management, Remote Server Operation, and More.

Your browser does not support the video tag.
Get the Book Now

More Topics to Explore

Displaying User Login Status Icon in Navigation Bar

User Login Status Icon on Navigation Bar

Introduction to Visual Mode in Vim Editor

Visual Mode

Using Makemigrations and Migrate in Django

Makemigrations and Migrate

Displaying User Login Status Icon in Navigation Bar

User Login Status Icon on Navigation Bar

Introduction to Visual Mode in Vim Editor

Visual Mode

Using Makemigrations and Migrate in Django

Makemigrations and Migrate

Tags:

Superuser

Access Mode

Permission

Normal User

Linux Introduction
Course Content

Chapter 1. Linux Basics

What Is OS?

CUI and GUI

Linux Distributions

Package Manager

Kernel and Shell

Current Working Directory

Linux Directory Structure

Absolute Path and Relative Path (Linux OS)

Linux Command Syntax

Special Characters and Escape Character

Chapter 2. Linux Key Commands

Setting Up Linux Environment on AWS

pwd (Print Working Directory)

cd (Change Directory)

ls (List Contents of Directory)

mkdir (Make Directory)

rmdir (Remove Directory)

touch (Create File)

rm (Remove File)

mv (Move File and Directory)

cp (Copy File and Directory)

cat (Display File Content)

sort (Sort File Contents)

grep (Global Regular Expression Print)

Regular Expression

find (Find File and Directory)

Wildcard

ln (Create Link to File and Directory)

Chapter 3. Vim Editor

What Is Vim and How to Launch It?

Normal, Insert and Visual Mode

Normal Mode (1) – Move Cursor

Normal Mode (2) – Delete

Normal Mode (3) – Copy and Paste

Normal Mode (4) – Undo and Redo

Normal Mode (5) – Search Phrase

Normal Mode (6) – Replace Phrase

Normal Mode (7) – Save and Exit

Insert Mode

Visual Mode

Chapter 4. User, Group and Permission

What Are User, Group And Permission in Linux?

Permission (Access Mode) by Owner Status

Superuser (Root User) vs. Normal User

sudo (Run Command with Superuser Privileges)

su (Switch User)

useradd (Add User)

passwd (Set Password)

userdel (Delete User)

Group – Primary Group and Secondary Group

groupadd (Add Group)

usermod (Modify User Account Information)

gpasswd (Add and Delete Users to Group)

groupdel (Delete Group)

chown (Change Owner of File and Directory)

chgrp (Change Group of File and Directory)

chmod (Change Access Mode)

chmod Command with Numbers

w and who (Check Current User Login Status)

id and groups (Check User ID and Group)

getent (Display User and Group Data)

Chapter 5. Redirection, Pipe and Shell Script

Standard Input Output and Redirection

Pipe (Combine Commands)

less (Display Content with Pager)

tr (Replace Characters)

cut (Extract Data Sections)

uniq (Extract Unique Data Lines)

Shell Script

echo (Echo input)

read (Read and Store Input)

Shell Variable and Environmental Variable

source (Execute Shell Script and Refresh Environmental Variables)

Chapter 6. Linux Commands for Command Management

history (Check Command History)

alias (Create Command Shortcuts)

man (Display Manual)

type, which and whereis (Display Command Information)

Package Manager Command

tree (Display Directory Tree)

Chapter 7. SSH Remote Connection

SSH (Secure Shell)

Locate .ssh Directory

SSH Remote Login (1) – Use Key Pair Generated by Server

SSH Remote Login (2) – Use Key Pair Generated by Client

SSH Config File

SSH Remote Login with Visual Studio Code

SCP (Secure Copy Protocol)

SCP with SSH Config File

SFTP (Secure File Transfer Protocol)

Other File Transfer Commands

Chapter 8. Linux Process Management

Process and Job

Foreground and Background Jobs

jobs and ps (Display Jobs and Processes)

Signals

Create, Stop and Terminate Jobs

Daemon Processes

What Is Service on Linux?

Systemd

Unit File

Systemctl Sub-Commands

Create Custom Unit and Start at Boot

Firewall

UFW (Uncomplicated Firewall)

Web Server

Launch Apache Web Server

Chapter 1. Linux Basics

What Is OS?

CUI and GUI

Linux Distributions

Package Manager

Kernel and Shell

Current Working Directory

Linux Directory Structure

Absolute Path and Relative Path (Linux OS)

Linux Command Syntax

Special Characters and Escape Character

Chapter 2. Linux Key Commands

Setting Up Linux Environment on AWS

pwd (Print Working Directory)

cd (Change Directory)

ls (List Contents of Directory)

mkdir (Make Directory)

rmdir (Remove Directory)

touch (Create File)

rm (Remove File)

mv (Move File and Directory)

cp (Copy File and Directory)

cat (Display File Content)

sort (Sort File Contents)

grep (Global Regular Expression Print)

Regular Expression

find (Find File and Directory)

Wildcard

ln (Create Link to File and Directory)

Chapter 3. Vim Editor

What Is Vim and How to Launch It?

Normal, Insert and Visual Mode

Normal Mode (1) – Move Cursor

Normal Mode (2) – Delete

Normal Mode (3) – Copy and Paste

Normal Mode (4) – Undo and Redo

Normal Mode (5) – Search Phrase

Normal Mode (6) – Replace Phrase

Normal Mode (7) – Save and Exit

Insert Mode

Visual Mode

Chapter 4. User, Group and Permission

What Are User, Group And Permission in Linux?

Permission (Access Mode) by Owner Status

Superuser (Root User) vs. Normal User

sudo (Run Command with Superuser Privileges)

su (Switch User)

useradd (Add User)

passwd (Set Password)

userdel (Delete User)

Group – Primary Group and Secondary Group

groupadd (Add Group)

usermod (Modify User Account Information)

gpasswd (Add and Delete Users to Group)

groupdel (Delete Group)

chown (Change Owner of File and Directory)

chgrp (Change Group of File and Directory)

chmod (Change Access Mode)

chmod Command with Numbers

w and who (Check Current User Login Status)

id and groups (Check User ID and Group)

getent (Display User and Group Data)

Chapter 5. Redirection, Pipe and Shell Script

Standard Input Output and Redirection

Pipe (Combine Commands)

less (Display Content with Pager)

tr (Replace Characters)

cut (Extract Data Sections)

uniq (Extract Unique Data Lines)

Shell Script

echo (Echo input)

read (Read and Store Input)

Shell Variable and Environmental Variable

source (Execute Shell Script and Refresh Environmental Variables)

Chapter 6. Linux Commands for Command Management

history (Check Command History)

alias (Create Command Shortcuts)

man (Display Manual)

type, which and whereis (Display Command Information)

Package Manager Command

tree (Display Directory Tree)

Chapter 7. SSH Remote Connection

SSH (Secure Shell)

Locate .ssh Directory

SSH Remote Login (1) – Use Key Pair Generated by Server

SSH Remote Login (2) – Use Key Pair Generated by Client

SSH Config File

SSH Remote Login with Visual Studio Code

SCP (Secure Copy Protocol)

SCP with SSH Config File

SFTP (Secure File Transfer Protocol)

Other File Transfer Commands

Chapter 8. Linux Process Management

Process and Job

Foreground and Background Jobs

jobs and ps (Display Jobs and Processes)

Signals

Create, Stop and Terminate Jobs

Daemon Processes

What Is Service on Linux?

Systemd

Unit File

Systemctl Sub-Commands

Create Custom Unit and Start at Boot

Firewall

UFW (Uncomplicated Firewall)

Web Server

Launch Apache Web Server