• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

Understanding File Permissions On Linux With Chmod

CJ Saathoff

Published on: June 27, 2024

Categories: Linux Command Line 0

On Unix-like operating systems like Linux, the operating system consists of files and folders. With everything coming back to files and folders, access control of them is extremely important. Think about it with the right level of access you can do anything. File permissions allow us to restrict access to only those who should have that access.

In this blog post, we will go over basic file permissions, what they are, how they are represented, how to check, and how to change them.

Table of Contents
  • What Are File Permissions?
  • How Permissions Are Represented
  • Putting It Together – Checking File Permissions
  • Changing File Permissions
    • Chmod Examples
  • Conclusion
  • Additional Links

What Are File Permissions?

File permissions control access to files and directories. It specifies what users or groups can access, read, and write to specific files and directories.

Permission on Linux is split into three groups which help separate who has access to what files and directories. Below are those three in the order they will be shown.

  • File Owner
  • Group Owner
  • Other users

How Permissions Are Represented

Permissions are represented in one of two ways text or numeric. They include no permission, read access, write permission, and execute permissions (for example needed by applications, shell scripts, and folders). Below shows how they are represented both ways.

Text

  • r The file can be read
  • w The file can be written to
  • x The file has execute permission (allows a file to be run as an application)
  • – no permissions

Numeric

Now let’s see which number matches to the text version shown above:

  • r=4
  • w=2
  • x=1
  • –=0

Putting It Together – Checking File Permissions

The easiest way to check file permissions is to use the ls command using the -l flag as shown below.

ls -l

Running this command will list the files and directories in your current working directory

For example:

-rw-r--r-- 1 example example 2541 May  8 18:25 file.txt

In this example the example user has read and write.
Where the example group and other users would only have read access

In numeric form, this would be displayed as 644.

Changing File Permissions

To change file permissions on Linux use the chmod command. The basic syntax for the command is shown below.

chmod [options] file

Options would typically be the file permissions you want to apply or change as shown in the below section.

Chmod Examples

Both text and numeric options can be used with chmod as shown in the examples below.

Adding a specific permission for all three groups

chmod +x file.txt

This option will remove the executable bit to all three permissions so if the file was 755 it would now be 644 or -rwxr-xr-x.

Note this can be used with the other options (r and w) just remember it applies to all three permission groups.

Removing specific permission for all three groups

chmod -x file.txt

This option will make remove the executable bit to all three permissions so if the file was 755 it would now be 644 or -rwxr-xr-x.

Setting permissions in numeric form

chmod 640 file.txt

Setting the permission means that only the file owner can edit the file, whereas the only other users who can access the file below belong to the group owner.

Conclusion

File permissions on Linux, are an absolute necessity for access control. It allows for varied levels of keeping users away from files they don’t need access to. In this blog post, we focused on file permissions from the command line. We explored basic Linux file permissions from what they are, how they are respresented, how to check, and how to change them.

Additional Links

Done reading and looking for additional links why not check these out?

  • Arch Wiki File Permissions
  • Wikipedia File System Permissions POSIX
CJ Saathoff

Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.

Related Posts

Bash Conditional Expressions: [[ vs [ vs test

In bash scripts, we use conditional statements frequently. Whether it’s in an “if fi” logic block or within a “while” or “do” loop, we evaluate statements all the time to determine whether they’re true or false, and perform various actions based on the result. True to form, there are multiple ways to do this, and […]

How to Use Git Rebase Interactive to Manage Commits

As a project progresses, commits can get messy. The git rebase interactive feature allows you to keep a clean commit history.

Systemd Service File Example – How it Works

The service file manager in Linux - systemd - is configured using something called "unit files". Here's an example, and how it works.

All About Bash Parameter Expansion

Parameter expansion in bash is very useful when working with strings like filenames and log entries. It allows you to clean up text.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA