Master Linux File Permissions: Owner, Group, and Mode Management Explained
This guide walks through Linux's multi‑user permission model, explains how to read file attributes with ls, and provides detailed usage of chown, chgrp, and chmod—including symbolic and numeric methods—to securely manage owners, groups, and access rights for files and directories.
Introduction
Linux supports multiple users and multitasking, so it never forces a shutdown and protects each user's privacy. Every file or directory has three identities—owner, group, others—each with three permissions: readable, writable, executable.
Document Attributes
Use ls -al --full-time or its alias ll to view all file attributes. The output has seven columns:
File type and permission bits (first character indicates type, next nine represent rwx for owner, group, others).
Link count.
Owner name.
Group name.
Size in bytes.
Last modification timestamp.
File name (names starting with a dot are hidden).
Changing Owner (chown)
Location
etc/passwdOnly accounts listed in /etc/passwd can be set as owners.
Syntax
chown [-R] [user] [file|dir] chown [-R] [user]:[group] [file|dir]Use -R for recursive changes. Although chown can also change the group, chgrp is recommended for that purpose.
Examples
chown daemon test # change owner of "test" to daemon chown daemon:root test # change group of "test" to root chown root.users test # set owner to root and group to users chown .root test # change only the group to rootChanging Group (chgrp)
Location
etc/groupThis file lists all groups.
Syntax
chgrp [-options] [group] [path]Examples
chgrp -R users test # recursively set group of "test" and its contents to usersIf the group does not exist, an "invalid group" error is returned.
Changing Permissions (chmod)
Linux permissions consist of read, write, and execute for each of owner, group, and others, yielding nine possible bits. Permissions can be modified using symbolic or numeric methods.
Symbolic Method
Use u, g, o (or a for all) for identities, r, w, x for permissions, and +, -, = for adding, removing, or setting.
Set (=)
chmod u=rwx,g=rwx,o=rwx test chmod ugo=rwx test chmod a=rwx testRemove (-)
chmod u-x,g-x,o-x test chmod ugo-x test chmod a-x testAdd (+)
chmod u+x,g+x,o+x test chmod ugo+x test chmod a+x testNumeric Method
Permissions are represented by numbers: read=4, write=2, execute=1. Sum them for each identity.
chmod 777 test # rwx for owner, group, others chmod 666 test # rw- for all chmod 755 test # rwx for owner, r-x for group and othersFile vs Directory Permission Differences
Files
readable : can read file contents.
writable : can modify file contents.
executable : can be executed as a program.
Note: Write permission on a file does not allow deletion; deletion is controlled by directory permissions.
Directories
readable : can list directory contents (e.g., ls).
writable : can create, move, delete, or rename entries inside the directory.
executable : can enter the directory (e.g., cd).
To allow anyone to browse a directory, at least r or x must be set; reading file contents requires directory x plus file r .
Summary
Each Linux file can assign rwx permissions to owner, group, and others. Use chgrp to change groups, chmod to modify permissions, and chown to change owners, thereby protecting data security through proper permission management.
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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
