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.
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 rights1.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 username2.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 username3. 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 filenameHere -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 filenameDigit 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 filenameThis 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 filename5.2 Change owner and group
sudo chown newowner:newgroup filenameSummary
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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
