Fundamentals 7 min read

Master Linux File Permissions: Understanding ls -l, Ownership, and Links

This guide explains Linux’s multi‑user permission model, how to interpret the ls -l output, the meaning of file types and permission bits, differences between symbolic and hard links, and commands for changing ownership and permissions using numeric and symbolic methods.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux File Permissions: Understanding ls -l, Ownership, and Links

Linux is a multi‑user, multitasking system where file ownership is crucial for privacy. Each user has a UID and GID, which act like a business card to determine read, write, and execute rights.

Running ls -l in the root directory displays seven fields per entry, e.g., lrwxrwxrwx. 1 root root 7 Aug 18 21:27 bin -> usr/bin. These fields represent file type and permissions, link count, owner, group, size (KB), modification time, and name.

The first character indicates the file type: - regular file, d directory, l symbolic or hard link, b block device, c character device, s socket, p named pipe.

The next nine characters are permission bits, grouped in three for owner, group, and others, using r (read), w (write), x (execute), or - if the permission is absent.

The trailing dot may appear when SELinux security labels are present; it disappears if SELinux is disabled.

Symbolic links (symlinks) are special files that store a path to another file or directory, created with ln -s source dest. Hard links point to the same inode and are created with ln source dest. Key differences include:

Both provide alternate paths to a file.

Deleting a symlink breaks the link; deleting a hard link only decrements the link count.

Symlinks can span filesystems and networks; hard links must reside on the same filesystem.

To change file ownership, use chown [-R] username:group filename, where -R applies recursively to directories.

File permissions can be modified using two methods:

Numeric method : Permissions map to numbers (r=4, w=2, x=1). For example, chmod 700 filename grants full rights to the owner and none to group or others.

Symbolic method : Use u (user), g (group), o (others), a (all) with + (add), - (remove), = (set). Example: chmod ug+w filename adds write permission for user and group.

Additional notes:

Hidden files start with a dot ( .) and can be listed with ls -al.

Special directories: . (current), .. (parent), - (previous), ~ (home).

Linux also supports special permission bits s and t, which are less commonly used.

Source: 标点符的《Linux学习笔记:文件的权限》 (http://www.biaodianfu.com/file-permission.html)
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.

Symbolic Linkshard linkschmodchownFile Permissions
MaGe Linux Operations
Written by

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.

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.