Operations 8 min read

Master Linux Permissions: Root, Users, Groups, chmod & chown Explained

This guide explores Linux system management fundamentals, detailing the role of the root user, how to create and modify users and groups, examine file permission structures, and use essential commands such as sudo, chmod, and chown to control access and ownership on files and directories.

Raymond Ops
Raymond Ops
Raymond Ops
Master Linux Permissions: Root, Users, Groups, chmod & chown Explained

Linux System Management: Root, Users, Groups, Permissions

In the previous article we covered basic file operation commands (cp, mv, rm, grep, wc, and pipelines). This article continues the deep dive into Linux system management, covering the role of the root user, user and group management, permission inspection, and the use of chmod and chown commands.

1. Linux Root User

The root user (also called superuser or administrator) has unrestricted access to all system resources, allowing installation of software, modification of system files, and management of user accounts.

1.1 Switch to root user

You can switch to the root account with the su command: su After entering the root password you obtain full root privileges.

1.2 Use sudo command

Modern distributions recommend using sudo to run commands that require root privileges instead of logging in as root.

sudo apt-get update  # execute a command with root rights

1.3 sudoers file

The configuration for sudo resides in /etc/sudoers, which defines which users and groups may execute which commands.

2. Users and User Groups

Linux is a multi‑user operating system; managing users and groups is essential for security and permission control.

2.1 User Management

Add a new user: sudo adduser username Delete a user: sudo deluser username Change a user’s password:

sudo passwd username

2.2 Group Management

Add a group: sudo groupadd groupname Delete a group: sudo groupdel groupname Add a user to a group:

sudo usermod -a -G groupname username

3. Viewing Permission Information

Each file and directory has a set of permissions that determine who can read, write, or execute it.

3.1 View file permissions

Use ls -l to list permissions: ls -l filename Sample output:

-rwxr-xr-- 1 owner group 4096 Dec 20 12:34 filename

Here -rwxr-xr-- means the owner has read, write, and execute rights, the group has read and execute rights, and others have read only.

3.2 Permission components

r

: read permission w: write permission x: execute permission

4. chmod Command: Changing File Permissions

The chmod command modifies file and directory permissions.

4.1 Numeric mode

chmod 755 filename

Digit 7 (rwx) gives the owner full rights, 5 (r-x) gives the group read and execute rights, and the final 5 gives others the same.

4.2 Symbolic mode

chmod u+x filename

This adds execute permission for the file’s owner.

5. chown Command: Changing File Owner and Group

The chown command changes the ownership of files and directories.

5.1 Change file owner

sudo chown newowner filename

5.2 Change owner and group

sudo chown newowner:newgroup filename

Summary

This article covered core Linux system management concepts: the role and privileges of the root user, how to manage users and groups, how to inspect permission settings, and practical usage of chmod and chown to control file access and ownership.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxUser ManagementPermissionschmodchown$root
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.