Understanding Linux Users, Groups, and File Permissions
This guide explains Linux user and group concepts, file ownership, permission bits, and practical commands like chgrp, chown, and chmod for managing access control on files and directories.
Users and Groups
Linux is a multi‑user system where each file has an owner, a group, and others. The owner controls who can read, write, or execute the file; groups allow a set of users to share permissions, and "others" apply to everyone else. The superuser root has unrestricted access.
Linux File Permission Layout
Running ls -al as root shows seven columns: file type, permission bits, link count, owner, group, size, and timestamps. The first character indicates the file type ( d for directory, - for regular file, l for symlink, b for block device, c for character device).
The next nine characters are three groups of rwx for owner, group, and others. r = read, w = write, x = execute; a dash means the permission is absent.
i‑node and Link Count
The third column shows how many directory entries point to the same i‑node. An i‑node stores metadata such as owner, permissions, timestamps, and size.
Use exit to leave the root shell after performing privileged operations.
Changing Ownership and Permissions
chgrp – change the group of a file (the target group must exist in /etc/group ).
chown – change the owner (must be a user listed in /etc/passwd ) and optionally the group.
chmod – modify permission bits, either with numeric mode (e.g., chmod 755 file ) or symbolic mode (e.g., chmod u=rwx,go=rx file ).
Numeric vs Symbolic Modes
Numeric mode uses a three‑digit octal number: r=4, w=2, x=1. For example, chmod 777 grants all permissions to everyone, which is insecure.
Symbolic mode uses u (user/owner), g (group), o (others), and a (all). Operators + (add), - (remove), and = (set) adjust specific bits, e.g., chmod a+w file adds write permission for everyone.
Directory Permissions
Directories also have r, w, and x bits. r allows listing contents, w permits creating, deleting, or renaming entries, and x permits entering the directory with cd.
File Types and Extensions
Linux does not rely on filename extensions for execution; the x bit determines executability. Common file types include regular files, directories, symbolic links, block devices ( b ), character devices ( c ), sockets ( s ), and FIFOs ( p ). Some typical extensions are .sh for shell scripts, .tar / .gz / .zip for archives, and .html / .php for web files.
Locale Configuration
To change the system language, edit /etc/profile and set export LANG="en_US.UTF-8" for English or export LANG="zh_CN.GB18030" for Chinese, then reload with source /etc/profile.
Why Proper Permissions Matter
They protect the system from unauthorized access.
They enable controlled sharing in team environments.
Misconfigured permissions can lead to data leaks or security breaches, so always follow the principle of least privilege.
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.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
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.
