Permissions & Ownership

Intermediate

Overview

Every file has permissions for three classes: the owner (user), the group, and others. Each class can read (r), write (w), and execute (x).

In ls -l output, the first column looks like -rwxr-xr--: a type character followed by the three permission triples. They map to octal numbers where r=4, w=2, x=1.

chmod changes permissions (e.g. 755 or u+x), while chown changes the owning user and group. Use the chmod Calculator tool to convert between octal and symbolic.

Cheatsheet

ls -l fileView permissions and ownership
chmod 644 filerw for owner, r for group/others
chmod +x script.shMake a script executable
chown user:group fileChange owner and group
umaskShow default permission mask

Try it

A safe, simulated terminal. Run the suggested commands to see typical output.

simulated terminal

Type a command and press Enter, or click a suggestion below to run it.

$

Quick quiz

1. What octal value means read+write+execute for the owner only, nothing for others?

2. Which permission character allows running a file as a program?