Fundamentals 10 min read

Understanding Linux Shell Mechanics and Permission Management

This article explains how the Linux shell works as an interface to the kernel, describes user and group concepts, details file types and permission representations, and provides step‑by‑step guidance on using chmod, chown, chgrp, umask, and sticky bits to manage access control.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Understanding Linux Shell Mechanics and Permission Management

Shell command execution principle

Linux consists of a kernel and a shell program that provides a user interface. Users issue commands to the shell, which parses them and forwards the requests to the kernel for execution. The shell also isolates the kernel from direct user access. Bash is a common shell.

The shell has two main roles: (1) transmitting user commands to the operating system for execution, and (2) protecting the kernel.

Linux permission concepts

Permissions determine whether a specific action is allowed for a particular user. Linux defines two user categories: the superuser (root, prompt "#") who can do anything, and regular users (prompt "$") with limited rights.

User classes

Owner (User) – u Group – g Others –

o

File types

The first character of a long ls -l listing indicates the file type:

d: directory
-: regular file (text, libraries, executables, source)
l: symbolic link
b: block device
p: pipe
c: character device
s: socket

Permission bits

r – read (files) or list (directories)

w – write (files) or modify contents (directories)

x – execute (files) or enter (directories)

Representations

Permissions can be expressed symbolically (e.g., rwx) or numerically in octal (e.g., 7 = rwx).

Managing permissions

chmod – change file mode

Only the file owner or root can modify permissions. chmod [options] mode filename Common option: -R – apply recursively to directories

Symbolic mode uses u/g/o/a with +, -, or = to add, remove, or set permissions. Example: chmod u+x script.sh Numeric mode uses three octal digits for owner, group, and others. Example:

chmod 755 mydir   # rwxr-xr-x

chown – change owner

chown [options] user[:group] filename
-R

– recursive

Root privileges are required to change ownership.

chgrp – change group

chgrp [options] group filename
-R

– recursive

Root privileges are also required.

umask – file creation mask

New files are created with default permissions (typically 777 for files and 777 for directories) masked by the current umask. The effective permission is default & ~umask.

umask          # display current mask
umask 022      # set mask to 022

Changing umask only affects the current session.

Sticky bit

When set on a directory (e.g., chmod +t /tmp), the sticky bit prevents users who have write permission on the directory from deleting or renaming files they do not own. Only the file owner, the directory owner, or root can delete such files.

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.

LinuxShellPermissionschmodchownumasksticky bit
Liangxu Linux
Written by

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.)

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.