Skip to main content
  1. Courses/
  2. Linux/

File Permissions

·397 words·2 mins· loading · loading ·
Russell Chubb
Author
Russell Chubb
Working at the intersection of Technology and Art.
Learn Linux - This article is part of a series.
Part 4: This Article

You’ve likely clicked this video for two reasons:

  1. You’ve just executed ls -l into your terminal and now it feels like you’re trying to read Minecraft Enchanting language.
  2. You’re a cool person, and you want to learn a little bit about file permissions (and how to alter them).

Let’s start with the basics — in Linux, every file and directory has a set of permissions that determine who can read, write, or execute them.

This is where the ls -l command comes in…

As you know from my previous video, ls -l returns a long listing format of the files in our current directory, which includes a 10 character string called the security “mode” of a file.

This “security mode” is the basis for understanding a file, or directory’s permission settings. Let’s start with the first character of the “security mode”, which represents the type of file:

  • - — Regular file
  • d — Directory
  • l — Symbolic link

The next nine characters in the security mode are the permissions, divided into three sections:

SectionRepresents
1stOwner’s permissions
2ndGroup’s permissions
3rdOthers’ permissions

In the context of file permissions:

  • Owner (u) — The user who owns the file.
  • Group (g) — A set of users that share the same permissions.
  • Others (o) — Everyone else.

Each of these groups has three types of permissions:

PermissionSymbolDescription
ReadrAllows you to read the contents of a file
WritewAllows you to modify a file
ExecutexAllows you to execute the file as a program

Modifying Permissions with chmod
#

You can modify these permissions using the chmod command (which stands for “change mode”).

For example, to give execute permissions to the other group for the directory test:

chmod o+x test
  • o — targets the “other” group
  • + — adds a permission
  • x — the “execute” permission
  • test — the directory being updated

You can also change multiple groups’ permissions in a single command. For example, the following will add read and write permissions to both the user and group, while also revoking the execute permission from others, for the file demo_file.txt:

chmod ug+rw,o-x demo_file.txt

That’s it for my rundown on file permissions in Linux! If you like the video, like the video. If you want to see more of me, press subscribe.

Thanks for watching, and I’ll see you in the next one!

Learn Linux - This article is part of a series.
Part 4: This Article

Related

Cat Command

374 words·2 mins· loading · loading
Introduction to the Cat Command in Linux

ls command

310 words·2 mins· loading · loading
Introduction to the ls command in Linux